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

Using variables between groups????

Status
Not open for further replies.

PQTIII

IS-IT--Management
Sep 21, 2004
110
How would I pass a variable between groups so that I can use it in a formula (hour 1 value - previous group's hour 12 value. The report is grouped on days and the hours 1 thru 12 are running total fields. All of this is displayed in the group section of the report. I need to figure out how to get that hour 1 diff value **.


day 1
Hour Tons Diff
1 1000 ABS(1-12) 0
2 1200 ABS(2-1) 200
3 1000 ABS(3-2) 0
4 1400 ABS(4-3) 400
...
12 1000 ABS(12-11) 100

day 2

** 1 1000 ABS(1-12) 0 *******
2 1200 ABS(2-1) 200
3 1400 ABS(3-2) 200
...
12 1000 ABS(12-11) 300

day 3



Thanks Paul



 
In your example, how could the abs(3-2) = 0? The ABS should be 200...

Anyway, a previous function still works for the next group, so the abs() formula should still be fine.

But if you want a variable, try:

numbervar MyNum:= abs({table.tons}-previous({table.tons})

Place this formula in the details AFTER the point where you wish to use it, such as right clicking the details and selecting insert section below and placing the formula there. Then in the first detail section of a new group the value is already set, but again, it shouldn't differ from the ABS() function.

-k

-k

 
k

You're right, typo! My problem is that all of the hour fields are running total fields in the group footer section. They just add up all of the tons moved in that certain hour of the shift. So they are not records, but totals. Sorry if I wasn't clearer.

Paul
 
Use formulas instead of RTs:

Group header:
numbervar MyVal:=0;

In the details:
Numbervar MyVal:=MyVal+abs({table.field}-previous({table.field}))

Group footer:
numbervar MyVal;
numbervar MySum:=MySum+MyVal;
MyVal

Now you can reference MySum in the group footer or later in the report.

Rather than showing JUST the output from your report, try creating a mini-spec for faster results:

Crystal version
Database/connectivity used
Example data
Expected output

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top