cancel
Showing results for 
Search instead for 
Did you mean: 

Placement and creation of a dynamin array

Former Member
0 Kudos

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

see it(see )

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

Accepted Solutions (0)

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

abhilash_kumar
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Abhilash

It works(kind of ), thanks. But is erratic ? When i click refresh, i have to press the "show next page" button until end of report.

If i click refresh, then Gtotal gets zeroed each page.

Not sure why i have to press the next page button for the whole report ?

thanks John

abhilash_kumar
Active Contributor
0 Kudos

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