Hide a column in cross-tab depending on the value of parameter (Crystal Reports XI) - crystal-reports

I'm using Crystal Reports XI (R2) and have a cross-tab which displays information about flights. There is the 'Total' column' as well as the Arrivals and Departures columns which are created automatically thanks to the grouping condition. What I'm trying to do is to have the 'flight directions' parameter, where the user can select 'All, departures only or arrivals only' values and according to this selection the cross-tab would have one or two columns. How can this be achieved? I tried using the following formula(and have the suppress empty columns option enabled) :
if {?Pm-#flight_direction_description} = "Departures Only"
then
if ({Command_1.IsArrival} = 1)
then 0
else {Command_1.IsArrival}
which indeed works (only one column is displayed) but then under the Departures column it lists all the flights (so the departures column is the same as the Total column) whereas it should only display information about departing flights.

I've had similar situations come up; while certainly not ideal, and if no one has any better suggestions, you could create Detail A, Detail B and Detail C sections, all of them suppressed. From there...
You could put your "All" crosstab in Detail A
Create a second crosstab for Destinations only, and put that in Detail B
Create a third crosstab for Arrivals only, and put that in Detail C
Then, in your Detail A, B and C sections, you can condtionally unsuppress the section you want based on the parameter passed in.

Related

Organizing Multiple Details Sections in Crystal Reports 2013

I'm creating a report in Crystal Reports 2013 that will show the same metrics for a variety of different views. I'd like to layer them on top of each other vertically in different detail sections.
I'll try to explain best I can. I'm inserting the first query into the first report detail ('Details a'); this query has two rows.
I'm then inserting a similar query into another details section ('Details B'). I'd like each row in Details A to presented at the top of the report, and then each row of 'Details B' presented underneath that( So:
Details A Row 1
Details A Row 2
Details B Row 1
Details B Row 2
My problem is, when I go to Preview, the rows are organized like this:
Details A Row 1
Details B Row 1
Details A Row 2
Details B Row 2
Is there anyway to format Details sections so I can keep all rows within each details section next to each other? Please let me know if more information would be helpful.
Use 2 subreports (Insert, Subreport).
This would allow subreport #1 to show all details rows from one data source.
And subreport #2 would show all details rows from the other data source.
What is going on is a cartesian product. In other words, the set of your first query brings 2 rows, while the set of you second brings another 2 rows. So, 2x2=4 rows.
Another thing to notice, is that details A and B are not independent. That is not very intuitive, i know. Let me try to tell you how Crystal deal with that (it is not how it really works, just an helpful view to understand it):
Crystal executes your two queries.
The result of the first query has 2 items, namely 1 and 2.
The result of the second query has other 2 items, namely 3 and 4.
Crystal check the link between the two result sets. Since - i suppose - you did not tell to Crystal what is that link, Crystal suppose there are no links, so it makes the cartesian product resulting in 4 rows, namely 1/3, 1/4, 2/3, 2/4.
Then Crystal makes a kind of "foreach" statement. So, foreach of the 4 rows, it prints one instance of the details section.
Since your details section has 2 subsections, namely details A and details B, it will end up with 4 details printing, as you saw:
1 //1st detail section, subsection A, field from 1st result set
3 //1st detail section, subsection B, field from 2nd result set
1 //2nd detail section, subsection A, field from 1st result set
4 //2nd detail section, subsection B, field from 2nd result set (second item)
2 //3st detail section, subsection A, field from 1st result set (second item)
3 //3st detail section, subsection B, field from 2nd result set
2 //4nd detail section, subsection A, field from 1st result set (second item)
4 //4nd detail section, subsection B, field from 2nd result set (second item)
So, as #MilletSoftware already pointed out (while i was writing this, hahah), the simplest solution is to use two subreports.

Crystal Report - two detail sections each showing their own subset of data

Is it possible to have a Crystal Report with two detail sections with each showing a subset of the results returned from the SP that the report is linked to?
For example in DetailA I want the records where FieldA in (a,b,c) and in DetailB I want records where FieldA in (d,e,f)
I know there is the Select Expert that can be used but that seems to work across the whole report rather than each individual detail section
It would be nice if I didn't need to create formulas as there are about 20 fields in the detail sections. Is there some kind of master formula that can be applied to the detail section as a whole?
You can do this pretty simply by just setting up your two Details sections the way that you want and placing all of the records' fields you want to display in each. Then, add a suppression formula to each of the Details sections. You can access the suppression formulas of each section by right-clicking that section, choosing 'Section Expert', and then clicking the formula button next to 'Suppress (No Drill-Down)'
Detail Section A: not({table.fieldA} in ['a','b','c'])
Detail Section B: not({table.fieldA} in ['d','e','f'])
Now, your Details A section will only display when the record is of type a, b, or c and your Details B section will only display when the record is of type d, e, or f.
While Ryan's method will work, it is a good idea to add to it and group by a formula field:
if {table.fieldA} In ['a','b','c'] then
'Group 1'
else
'Group 2'#
Then add the suppression formula for details A & B as:
{#MyGroup} = 'Group 2' and {#MyGroup} = 'Group 1'
This provides three benefits:
It will automatically sort the two sections into Group 1 and Group 2
It will only ever show one or the other, and always show one, Ryan's method could hide unexpected details which can cause problems
It is much easier to maintain as you're not keeping different lists in different sections

Details rows inside tablix SSRS Reporting service, Records with Details rows under it

Now it is a report with a tablix in which the records are like every row has some details rows under it. and the details row can have one or more records based on the main tablix rows
To elucidate the problem, plz have a look
Did some search here and there, but not able to figure out how to accomplish this.
Sub-reports inside the tablix cell, but how will it keep the track of the current row
One thing more : Do I need to create two separate datasets for this and bind accordingly or write query as a single dataset and do some grouping ?
any ideas !
P.S: SSRS r2 environment, native mode reports for web application
You can achieve this with one Dataset and one Tablix.
The Dataset will have all the columns in the report, with multiple rows for each BIL value.
The Tablix will have four rows and one group based on BIL.
The first row will be the Tablix header row, with the main column header details.
The next two rows will be group header rows. The first row will contain the group details, BIL, No Bayar, etc. The second row will contain the detail row header details.
The last row will be the detail row which will contain the COL1 and COL2 detail values.
You will see something like this (you'll need to fill in the TextBox details as appropriate):
create report with subreport will solve your problem
you can create one report with one dataset with (BIL NoB NoW Est TotalXYZ) columns.
Now link that subreport with the BIL
Now link subreport with main report the BIL (FK)
Hope this help

Crystal Reports 7 CrossTab Suppress Column

I'm trying to modify a report created in Crystal Reports 7 (which I know almost nothing about). I want to use a CrossTab, as this seems to be the best way to accomplish what I want. I have a column with three possible values: A, B, C. The cross tab creates three columns. I want to suppress C. How can I do this?
Also, is there anyway to create rows based on one field (i.e. a PK value), but display another - like a description? For example, if a list of states have a PK value of 1-50, I want them ordered by PK, but I want to display the state name.
All you ask is possible;
i suggest not to use cross tab: cross tab is intended for an uknown number of rows and columns (varying on data) ad for summarizing (max value, sum of values) results on a grid.
you should, instead:
Create a blank report
Drop the fields from the Field explrorer into the Details Section (just A and B columns)
Use Report Sort Expert to sort elements no the PK value

Hide row in Crystal Reports Crosstab

Is it possible to hide a row in a crystal reports crosstab?
I have two rows that are only used to calculate a third row and I would like to hide them so only the result is visible to the user.
I have similar problem. I want to display only rows that have specific values and ignore all others.
Here was my solution:
Open Cross-Tab Expert. In Cross-Tab under Rows select your row which should be conditional suppressed. Then select Group Options. This will open Cross-Tab Group Options dialog. Go to Specified Order and add filter. In this case, rows that match your criteria will be displayed in your cross-table all other rows will be placed in one row "Others". Then select tab Others and check Discard all others.
Not directly. I recommend grouping by a custom formula.
For example, let's say you have a crosstab that is grouped by StoreName. StoreName has values groups "A", "B", and "C". You want to combine "B" and "C".
Make a new formula field. Call it StoreName_Combined. In your new formula, enter:
If {StoreName}="B" or {StoreName}="C" then "B+C" else {StoreName}
In your crosstab, use StoreName_Combined instead of StoreName.
Edit
If you look around a little, you may also think about using Cross-Tab Expert->Group Options->Options->Use a Formula as a Group Name, but I couldn't get it to work. The rows stay separate, they just have the same name, which doesn't really help.