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

Changing report variable.

Status
Not open for further replies.

byteias

Programmer
Apr 17, 2007
68
US
I need to change some values for a variable used on the PH (page header) before printing a subreport used on RF (report footer).
For my Grand Totals, I want "Whatever" and for the RF "SUMMARY".
I used the following "if onlastrecord then "SUMMARY"
else "Whatever" and the problem is that it shows up in my Grand total as a "SUMMARY".
Thanks,
Ivan.
 
Used Shared Variables to pass something back from the subreport. Test for it on any section after the section that calls the subreport. THis should allow you to do an extra test for the Grand Total.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Instead of speaking abstractly, please show the formulas you are using and where (in what sections) you are putting them. Clarify exactly what you expect to see where. It is unclear what the subreport has to do with anything, also.

-LB
 
I created a variable for my headings and the formula used is:
if onlastrecord then "SUMMARY" else "Whatever"
The variable gets changed when prints the grand totals and only I want to change the variable when I print the report footer that uses a subreport.
I will try with shared variables as mentioned by Madawc.
Thanks.
 
You are showing no variables in your formula. In what section are the grand totals placed? RF_a? With the sub in RF_b? I don't think shared variables are relevant here.

-LB
 
The grand totals are placed in RF_b (rf_a is where I tried to reset the variable).
 
Insert another report section RF_c and move your sub there. Then create formulas like these:

//{@false} to be placed in the report header:
whileprintingrecords;
booleanvar flag := false;

//{@true} to be placed in RH_c:
whileprintingrecords;
booleanvar flag := true;

Then change your page header formula to:

whileprintingrecords;
booleanvar flag;
if flag = true then
"SUMMARY" else
"Whatever"

I'm assuming you will have RH_c formatted to "new page before" in the section expert.

-LB
 
I did what you mentioned to me,but the sub in RF_c doesn't show "SUMMARY"...
The flag is set to TRUE and the variable doesn't change.
thanks.
 
I'm not sure what you mean. It is the page header in the main report that should show "Summary". Please explain how you implemented my suggestion.

-LB
 
I just tested this to make sure, and it worked perfectly.

-LB
 
My headings comes from PH (main report) and I want to use the same headings in my subreport (RF_c) except for one variable that gets replaced to "SUMMARY".
I have the following groups:
PH Headings (TitletoBeChanged)
(whileprintingrecords;booleanvar flag:=false;)
GH1 Group 1 (are many groups)
GH2 sub-Group 1-1
GH3 Manager
Da details tableA (driver)
Db details tableB (slave)
GF3 Manager Totals (uses a subReport)
GF2 sub-Group Totals (uses a subReport)
GF3 Group Totals (uses a subReport)
RF_a
RF_b
RF_c subreport(whileprintingrecords;booleanvar flag:=true;)

--
Using your criteria when it goes to RF_c the variable doesn't change.
Thanks.
 
{@false} belongs in the REPORT header, not the page header.

-LB
 
Good catch, you are the best..........
Thanks,
ivan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top