Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
515 views
in Technique[技术] by (71.8m points)

cumulative sum - Crystal Reports: global variable running total not displaying in header

Using Crystal Reports I'm trying to display the running total of a database field in the header where all the labels are.

I've attempted to do this by placing the running total (RTversion) into a formula field with the following:

Shared stringvar CurrentVers; 
CurrentVers := {#CurrentVers}; 

and then in the page header section I have the following:

Shared stringvar CurrentVers; 
EvaluateAFter({#currentVers}); 
CurrentVers; 

with {#CurrentVers} running the 1st largest number.

Is this incorrect?

Update: The goal is to display the latest version in the header near the labels to show what the current verseion is for comparison.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Running-Total Fields, in my experience, only work in the footer sections.

You will need to create a manual running total.

Add a formula field to the Details section that populates a Global variable with whatever you are trying to capture. Something like:

//use WhileReadingRecords if the values can be gathered as the report pulls in values from the database.  Otherwise, use WhilePrintingRecords. 
WhileReadingRecords;
Global Stringvar CurrentVers;
//logic here to capture what you want
CurrentVers:=...

Add another formula field to the Header section. Add these two lines to it:

WhilePrintingRecords;
Global Stringvar CurrentVers;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...