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!

Static data within report - changed only once a year, used in Calculat

Status
Not open for further replies.

Tiina

Vendor
Sep 1, 2006
8
CA
Hello there,

Trying to find out how to enter data such as :

Date ranges (up to 3)
% (up to 3)
Amounts (more then 3)

That would only be changed by the client once a year, but it's used for calculating other formulas in the report.

Parameter fields have to be entered every time, is there a way to make a semi-permanent parameter that is only changed when user requests it?

Is there a way using SQL Expression fields?

Is there a way using an Excel based table, I tried this but don't get the date fields to work.

Thank you so much,

Tiina
 
You could set these up as variables in a formula that you place in the report header and then in formulas in the body of the report, you would reference the variables instead of the values directly. Then the only update would be to the report header formula:

whileprintingrecords;
datevar range daterange1 := date(2006,1,1) to date(2006,4,30);
numbervar percent := 50;
numbervar amt := 12;

-LB
 
Sounds good,

How do you use the formulas in the body to reference the variable.

Such that would display the date range: From 2006-1-1 to 2006-4-30.

Also, how would you use the numbervar percent within the other formula to calculate.

Thank you.
 
For the range display:

datevar range daterange1;
"From "+ totext(minimum(daterange1),"yyyy-M-d")+ " to "+
totext(maximum(daterange1),"yyyy-M-d")

For the percent calculation:

numbervar percent;
{table.price} * percent/100

Also (my mistake) remove the whileprintingrecords from the report header formula so that it reads:

datevar range daterange1 := date(2006,1,1) to date(2006,4,30);
numbervar percent := 50;
numbervar amt := 12;

Then you will be able to insert summaries on formulas in the report that reference the variables.

-LB
 
It sounds really brilliant, I'll try it.

Thank you kindly,

Tiina
 
Hi LB:

This doesn't work for some reason:
numbervar percent;
{table.price} * percent/100

What would the formula be for the amount?

Thanks again,

Tiina
 
You should be substituting your actual field for {table.price}. What is the calculation you want to perform? With what field(s)?

-LB
 
Ok,

Next question :)

datevar range daterange1 := date(2005,01,01) to date(2005,02,28);
datevar range daterange2 := date(2005,03,01) to date(2005,12,30);
datevar range daterange3 := date(0,0,0) to date(0,0,0);
numbervar percent := 50;
numbervar amt := 12;

Can I also create percent1, percent 2 ect?

Is there a way to calculate # of days between daterange1?

Thank you,
Tiina
 
To add other values, just use the variable designation (numbervar, datevar, currencyvar, etc.) that matches the datatype of the field and then add a name that helps you understand what it is, as in:

datevar range salesdtrange := date(2006,1,1) to date(2006,1,31);

//etc.

For number of days in a daterange use:

datevar range daterange1;
datediff("d", minimum(daterange1),maximum(daterange1))

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top