Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cross-tab calculated Member

Status
Not open for further replies.

BobSuruncle

Technical User
Jun 18, 2002
423
CA
Hi all,
I'm using Crystal Reports 2016.
I have a report that shows the properties of objects.
The data coming into the report has both the Current value of the properties and the Previous value.
e.g.

[tt]PropertyName, PropertyValue, HistoryType
ObjectColour, Green, Current
ObjectColour, Red, Previous
ObjectFont, Arial, Current
ObjectFont, Arial, Previous[/tt]

The report is grouped by Area (where the objects are located).
I'm using a Cross-tab to display the data, where the column is HistoryType, the Row is PropertyName and the Summarized value is the Max of PropertyValue.
The Cross-tab is in the Group Header for the Section.
This works well, but I'd like to suppress the Cross-tab if all of the properties in the Cross-tab have equal values for both Current and Previous.

In my sample data shown above, Object Colour is different for Current and History so, even though ObjectFont is the same for Current and Previous, I would want the Cross-tab to still be displayed.

In the data shown below, both properties have the same value for Current and Previous
[tt]PropertyName, PropertyValue, HistoryType
ObjectColour, Red, Current
ObjectColour, Red, Previous
ObjectFont, Arial, Current
ObjectFont, Arial, Previous[/tt]

What I was considering was to add a new calculated column that would return a value of 0 if the properties in a given row were identical, and a 1 if they were different.
If I could then sum up this calculated value, I'd like to suppress the Cross-tab if the summarized value was 0.

The problem is that I don't know how to create the calculated column, and then summarize it.
Further, I'm not sure if I could use that value to turn on the Suppress property for the Cross-tab.

Any suggestions?

Thanks.



Bob Suruncle
 
You could accomplish this through a work around. You would have to create the same crosstab in a GH-a section, with your original crosstab in GH_b. In the new GH-a crosstab, you would select an inner cell->right click->format field->suppress->x+2 and enter:

whileprintingrecords;
numbervar prev;
numbervar curr;
if gridrowcolumnvalue("table.historytype")="Previous" then //replace brackets from field name with "'s as shown
prev := currentfieldvalue else
if gridrowcolumnvalue("table.historytype")="Current" then
curr := currentfieldvalue;
true

Also suppress the row and column headings. In the crosstab expert, in the customize style tab, uncheck "show cell margins" and then click on "format grid lines" and uncheck "show grid lines". Now the crosstab should not be visible. Minimize the row height of the crosstab in design mode and then right click on the gray section to the left (where the section names are located) and check "fit section". Next go into the section expert and select GH-a and check "underlay following sections".

Finally, also in the section expert, select GH_b->suppress->x+2 and enter:

whileprintingrecords;
numbervar prev;
numbervar curr;
prev-curr=0

-LB
 
Sorry, just realized I tested with numeric values, but you are using strings. Let me get back to you with a fix, as just converting to strings won't work.

-LB
 
How many distinct PropertyNames are there?

-LB
 
There are around 20 properties, but the number of properties may change on each run.
We're returning the differences between current values and previous values for these objects.
For a given run of the report, 2 or 3 properties may have changed, but it's possible that 15 or 20 properties could change.
I appreciate your ideas Linda, but I think I'm going to mull things over for a while and see what comes of this.

Thank you!


Bob Suruncle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top