Question

I have a very basic report with no groups. The details consists of a number of numeric columns. I want to add a formula field which will use a field from the first row. Example:

(ColumnAFromCurrentRecord - ColumnBFromFirstRecord) / ColumnBFromFirstRecord

Can someone point me in the right direction?

Était-ce utile?

La solution 2

you need to extact the column b from first record. try below solution.

Note: This is not a tested solution as I at present I don't have CR.

create below formula Count and place in detail section:

Local NumberVar a;
a:=a+1;

This will number the rows starting from 1 to the last row.

Now create one more formula StoreB:

Share NumberVar b;

if {@Count}=1
then b:=columnb

This will store the value of columnb in first record in variable b

Now use where you want:

EvaluateAfter(@StoreB)
Shared NumberVar b;

(ColumnAFromCurrentRecord - b) / b

Let me know how it goes.

Autres conseils

1. Create a formula named AssignFirstValue and define it like this:

WhilePrintingRecords; 
Global StringVar strFirstValue := {MYDBNAME.MYSTRINGFIELD}; 

Put the AssignFirstValue formula in your Report Header and suppress it.

2. Create a formula named PrintFirstValue and define it like this:

WhilePrintingRecords; 
Global StringVar strFirstValue; 
strFirstValue 

Put the PrintFirstValue formula wherever you want to display the first value in your report.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top