I'm created 2 reports in SSRS 2008. I now plan on merging the reports into one and allow users to select report type via a drop down option.
The reports bring back the same data but are grouped differently.
Here lies the problem, I can't figure out how to alter the grouping depending on the report type.
Basically I want to do this
when Parameters!Report_Type.Value = "D" group by Fields!txiii_commodity.Value else no group
I've tried iif, and switch but never get the desired results.
Could someone please help.
Thanks in advance
Chris
I did this with a very simple example. Sample dataset:
Create a report with one group:
Grouped on expression:
=IIf(Parameters!Report_Type.Value = "D", Fields!txiii_commodity.Value, "Ungrouped")
Also used this to display the Group column in the report.
Results:
Related
Good people of stack overflow.
I am stuck on this one.my crystal report is using a joined query
str = "SELECT invoices.voucher,
invoices.customer_name,invoice_details.item_name,
invoice_details.Amount FROM invoices
LEFT OUTER JOIN invoice_details
ON invoices.voucher =invoice_details.voucher "
The crystal report is grouped by voucher and the details are placed on detail section of group details to display item name and item amount.
It is working perfectly in design.
However at run time in VBNET when i select exactly the same query i get repeating line items. Example if the invoice items in invoice_details table were three in my report the three items will be repeated three times.
I have checked all over the internet for the same complain. No luck.
Someone suggested "suppress if duplicate" on an item with unique number such as voucher number. I did not get success.
Has someone met this difficulty and can you suggest how to resolve this?
If it can be of help to someone else...
My difficulty in duplicating line items was coming from using two tables, invoices and invoice_details when designing the crystal report.
And then using the link feature at crystal report design.
I had not realized i ought to have designed crystal report using a stored view (access query from the database). While using the stored view i did not do any linking at designing report but used grouping expert to group by invoice numbers.
So the report finally worked well after much frustration.
I have this concern using Crystal Report which I am not really familiar with. Here's my scenario:
I have an existing report to update, I need to add a column (ETA) which has a datetime value. It may return more than one rows per Item No, I need to get the minimum date only per Item No from the result rows.
I already tried some solution mentioned here http://scn.sap.com/thread/1952829 but found no luck.
I used a suppression formula for the Details section of the report, but haven't succeeded yet.
IF {TableName.DateField} = Minimum({TableName.DateField}) THEN FALSE ELSE TRUE
Any possible things you can suggest me to try? Thanks in advance for this :)
good to get this value from sqlserver side. you just create a function which return a single data (minimum date).
If you wish in crystal report side, it is something you make loop of hundred for a single row display. You can use running total field for this.
Select the field , select summary type and put into the detail section.
or you can create a formula with group name option like
Minimum({TableName.DateField})
http://scn.sap.com/thread/1952829
http://businessintelligence.ittoolbox.com/groups/technical-functional/businessobjects-crystal-l/unable-to-filter-based-on-the-first-date-in-list-of-dates-4912881
please check
Running total field gives options for Min, Max, etc. but not Sum
http://flylib.com/books/en/4.229.1.28/1/
I have a report- from another question: Jasper report data summary which shows totals for a number of columns by location. I need to sub-total some of the location_cds and am not sure where to start. I have one group - by location_cd. Some location_cds have sub-locations, i.e. 3A has 3A1, 3A2, 3A3. Right now I have the totals for each individual row displayed in the group footer. I would like to see a subtotal for any location_cd that has sub-locations. I am trying to puzzle out how I am going to approach that. Should I see if I can do that in the query or will Jasper help me out here?
I am querying Sybase ASE 15.7.0 and am using Jasper Studio 5.5.1
Sub totals are the same as totals, just check the following:
add the order by corresponding to your list - usually add the item to the order by list
ORDER BY some_name_wharever, my_subtotal_thing_to_be_ordered
create a new group using the wizard, right click the root of the report on the report inspector and select "add report group"
create a new variable just like the total one but mind the reset and increment group
That should do it. Hope it helps. Good luck.
I feel like you are trying to create a crosstab, with different subtotals and a general total... Do try looking into crosstabs.. they may be tricky to use, but the end result is great if used properly!
How to get the result using formula field in crystalreport
for counting number of records where fieldname =xxx
like: select count(*) as cnt from tbl where f1=xxx
and explain more with examples for crystal report count() function.
Project: VB.Net
regards,
Sensa.
you basically create a formula field like:
if {mytable.field} = 'xxx' then
{mytable.field};
then count({formula});
or use running totals with an evaluation formula: {mytable.field} = 'xxx'
You can try this:
FormulaField1:
if {anytable.yourfield} = 'xxx' then 1 Else 0;
And then:
FormulaField2:
sum({formula1});
For integer:
FormulaField2:
CSTR (sum({formula1}),0);
There are several alternatives each with certain drawbacks.
1) Use the select expert to restrict the records in the report conditionally.
The major drawback in this case is of course loss of data probably relevant to other parts of the report
2) Solution 1) using a sub-report integrated in the main report.
The problem in this case is formatting constraints
3) Use grouping. I.E. group by mytable.field use a running total on the records
withing the group and insert to group header. Hide the group selectively trough the section expert.
Here again arises the problem of additional formatting constraints.
4) Finally if you have access to the actual database. Create a view, this will be the best solution in terms of performance and issues with formatting within crystal reports.
However creating a view each time this kind of problem arises can lead to polluting your database with views which will only be used infrequently.
I have a problem with running Total in Crsystal report9
if their is no values available for a Paticular field how can we return the running total as '0'
Instead of display the Running Total directly in your report create a Formula Field based on the Running Total and drag it into the report.
Your formula should look like this (Crystal Syntax)...
if ISNULL({#RunningTotalField}) then
"0.00"
else
ToText(RunningTotalField, 2)
If there is no data for that particular group, then Crystal won't show it easily. Your options are :
1) Use subreports to display the values for a particular group, and keep the main report just looking at the table(s) containing the group headers.
2) Use a stored procedure as the source so you have full control over the SQL that is run.
The problem is that as soon as you use a field to group, Crystal will only return records where that field has been used. If it was simply in the Details section you could modify the link to a LEFT JOIN and it wouldn't matter, but the group forces the INNER JOIN which means the groups without data are not returned.
Unfortunately Running Totals don't show up if there are no records that match your criteria. An alternative is to use a set of formulas calculated in various sections of the report. The technique is widely described in the Crystal literature. For example, this TekTips gives a very succinct overview of your options.
You set up an initialising formula in each header, with the evaluation time directive "WhilePrintingRecords". This approach was the only one available for doing running totals in the "good ol' days" before RunningTotal objects were available.