on 10-17-2011 7:49 PM
I have a report that returns between 100-200 records.
Sorted by @name+date
It is only 3 data columns.
Name - allocated - date
What i want to do is create a 4th column which is the
calculated by "current allocated" - "previous allocated"
i have this working with a formula that uses PREVIOUS/NEXT
However i am unable to total/summary this formula or even
so what i want to do is create a dynamic array for each column.
Name - allocated - date
How or where do i place the formula that holds the array data ?
thanks
Hi John,
Do you want to summarize only the 4th column? If yes, then I don't think you would need an array for each column. Or maybe I'm interpreting this incorrectly?
Anyway, the array, if it needs to be populated, has to be placed beside the field that it is referring to or in the same section.
For display purposes, you may place the variable on the Footers as applicable.
Also, since this is a print time formula you cannot create a summary off it and hence it does not show under 'Insert Summary'. You would need to create a manual running total.
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Abhilash,
In the 4th column, i want to calculate this record(allocated) - previous(allocated).
i currently have this formula(4TH COLUMN) that works :-
numberVar difference;
if onfirstrecord then
difference := 0
else
if {SRMARRAY.ARRAYALIAS} = previous({SRMARRAY.ARRAYALIAS})
then difference := ({SRMARRAYMETRICS.ARRAYALLOCTOTAL} -
previous({SRMARRAYMETRICS.ARRAYALLOCTOTAL}))/1024/1024
else 0
However i cannot summarize this formula as it uses PREVIOUS, that's my problem.
Hi John,
The formula looks good to me and you said the formula works fine isn't it? To summarize this column try these steps:
Right-click the 4th col and select Format field. Click on the formula button for 'Display String' and type in this formula:
numbervar gtotal;
gtotal := gtotal + currentfieldvalue;
totext(currentfieldvalue,0);
Create another formula and place this one on the report footer
whileprintingrecords;
numbervar gtotal;
Let me know how this goes!
-Abhilash
Hi John,
I'm not sure why the gtotal gets zeroed on each page; it should not. Is this column in the details section?
Here's something you could try with arrays as well:
1) Create this formula and place it in the section which holds the 4th column:
whileprintingrecords;
numbervar array arr;
numbervar i := recordnumber;
redim preserve arr<i>;
arr<i> := {Curr_Prev};
""
2) Create another formula and place this on the report footer:
whileprintingrecords;
numbervar array arr;
numbervar result;
numbervar j;
for j := 1 to ubound(arr) step 1 do
(
result := result + arr[j]
);
result;
Hope this helps!
-Abhilash
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.