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

Formula variable help!!

Status
Not open for further replies.

chomzky

Programmer
Nov 6, 2007
19
CA
I have to run a series of audit reports each month. For each month I count the number of audits(audit #) number of failed audits(yes/no ) and then do a calculation to find the failed percentage. Essentially 3 formulas.

Right now I have a start time and end time that I have to replicate in all 3 formulas. is there a way to store that start and end values in a variable that can be used in all 3 formulas?

Kurt
 
You could use variables. Set up a formula like this:

[Code {@SetVariables}]
WhilePrintingRecords;
Global TimeVar ST := [Insert start time formula here];
Global TimeVar ET := [Insert end time formula here];
[/Code]

Then, in each of your formulas where you need to refer to those variables, start them with:

Code:
WhilePrintingRecords;
Global TimeVar ST;
Global TimeVar ET;

,and you can refer to those variables in the formulas as ST and ET.

However it is not clear that Variables are even needed.

If all of the calculations are based on the same data set, it would be easier to just limit the report data to those in the time period required. Alternatively, if the calculations are being done on a sub-set of the report data, you could just create a formula for the start time and one for the end time, and refer to those formulas in your 3 calculations.

Hope this helps.

Cheers
Pee
 
tks for your help. The data set is a rolling year and I am reporting on each month separately.

One more quesiton If I may, Where do you declare the variable ?

K
 
The {@SetVariables} formula declaring the variable can be anywhere on the report, as long as it is before the variables are required in other formulas. You could put it in the Report Header - it can be suppressed in need.

Cheers
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top