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!

Yet another problem in Crystal. Formula in RT??? 1

Status
Not open for further replies.

slim2

Programmer
Oct 18, 2001
94
I have an array of 13 amts. I print the array field on the print line with this formula:

@Jan
Global numberVar array TotLnDol;
TotLnDol[1];

It seems that I cannot use @Jan in a RT??? Is there any way to do a running total on @Jan????

Thanks

 
There is always a way....

A new formula (JanRT)
Global numberVar array TotLnDol;
Global numberVar JanRT;

JanRT:=JanRT + TotLnDol[1];

(if you need to reset at a group, you'll need another formula using the three formula suggestion mentioned here many times before. This solution uses one of the three...)


Editor and Publisher of Crystal Clear
 
Thanks for the reply.

If I understand your reply then this is a "manual" way of doing RTs. Instead of using the RT facility I sum the fields myself and place the formula on the group footer.

Where can I find the three formula solution you mentioned.
 
It is in the FAQs for this forum - look for
faq149-182

(Ways of doing running totals). This is how we used to do running totals in CR6, for those of us who've been around a few years.
Editor and Publisher of Crystal Clear
 
Thanks again!

I will try to use this method, it may still be less time consumming to do all the calculations in in one formula using an array and then just sum the fields as you showed.

 
chelseatech,

One more question. I have placed the following in the Group Header, but it does not reset the variables to 0. Any thoughts??

Global NumberVar Array TotLnDl := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global numberVar JanRT := 0;
Global numberVar FebRT := 0;
Global numberVar PyrRT := 0;

Thanks again
 
Show us the structure of your report (ie. the groups) You are not giving us enough detail to explain what might be happening.

one caution though:

Since you are putting this formula in the GroupHeader...if this header splits across 2 pages you may run the risk of resetting your totals before you print them. So it is a good idea to format your formula as follows to prevent this.

if not inRepeatedGroupHeader then
(
Global NumberVar Array TotLnDl :=
[0,0,0,0,0,0,0,0,0,0,0,0,0];
Global numberVar JanRT := 0;
Global numberVar FebRT := 0;
Global numberVar PyrRT := 0;
)

Also I am wondering how the array is filled...what is the formula that fills the array values of TotLnD1



 
This is a using test data and the report, for now is a very simple accumulation, and does not exceed one page with one group break. I printed the detail for each line and the JanRt prints and accumulates for each record. When next group starts the JanRt prints what was printed at the last group level. By the way there is no more data for JAnRT after the first group break, so the field should be zero.

On the report header
Global NumberVar Array TotLnDl := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global numberVar JanRT := 0;


Global NumberVar Array TotLnDl;
NumberVar x;
x := ToNumber(Right({Tportf.LamtDate},2));
TotLnDl[x] := {Tportf.Lamt};


Global numberVar array TotLnDol;
Global numberVar JanRT;
JanRT:=JanRT + TotLnDol[1];

I hope this enough infirmationm If not let me know what else to supply.


 
Ngolem,

Thanks for the tip. I have found my problem. I did not specify WhilePrintingRecords. This is my first report and am still learning thos crystal quirks.

Thanks to all who helped.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top