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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset variable not working for me

Status
Not open for further replies.

Solojer

Technical User
Feb 28, 2008
54
CA
Hi there!

Using Crystal 10, I've got a report where I need to combine many records from the details into one field in the group header. The value of the fields in the GH needs to reset for each group.

For example, if the 1st group contains "apples", and the second group contains "oranges" then the field in the header of the first group should be "apples", and same field for the second group should be "oranges".

My problem is, for some reason the field in the header is not resetting after each group, and is adding to itself. So I'm getting "apples" in the first group header, and "apples oranges" in the second group header.

Here is the pertinant code:

Group header #1
Formula name @case#
Code:
[green]//GH1[/green]
[green]//Formula @Case#[/green]
[green]//[/green]
[blue]global stringvar[/blue] Allcase;
Allcase:=allcase&[blue]chr[/blue](12)&[blue]totext [/blue]{Table.Fieldname},0,"")

Group footer #1
Formula name @reset
Code:
[green]//GF1[/green]
[green]//Formula @reset[/green]
[blue]global stringvar[/blue] Allcase;
Allcase:="";

I've got a feeling it has to do with evaluation time of one or both of the fields, but I've tried what I think are all the combinations - except, of course, the right one! Any tips you could give me would be really very apprecaited!

 
What is the field that you are grouping on? Please also show a sample of detail records that contain the field with results of apple and orange.

-LB
 
Hi LB,

Thanks for your help with this. The field I am grouping on is Table.AgentFirstName. The details contain only a few fields: Case# (the "fruit" in my example above) and CaseDesc. The Case# field is a number (which is why I convert it to text in my above example), and the CaseDesc is a text field.

Ultimately, I would like to have all Case#'s for an agent appear in one field in the header of the document. Thanks!
 
You can't collect the values in a variable (which would occur whileprintingrecords, and AFTER the group header is printed), but you could either collect them in a variable in a subreport placed in the group header OR add a crosstab to the group header that uses case # as the column field, and then suppress the column label.

-LB
 
That's too bad. I was trying to get the case #s all in one field in the header so that I could use Visual CUT (are you familiar with this app?) to send agents an e-mail with their case #'s. Unfortunately, to do this, Visual CUT needs the field to be in the group header of the main report. I'll have to send agents an attachment of their case #s instead of just having them appear in the mail message. Thanks very much for all your help.
 
I'm not sure that is the way it works. You should contact Ido Millet directly. I think you are giving up too soon.

There are other ways to get case #'s in the group header. For example, you could use formulas like this, where you change the 1 to 2,3, etc.:

NthLargest(1,{table.caseno},{table.groupfield})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top