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

resetting an array for every line of data

Status
Not open for further replies.

johnuk1

MIS
Aug 18, 2004
13
US
in my page header i use a formula to declare a 24 element array.

I then have 24 formulas across the page such that formula1 reads element1 in array...formula 2 reads element 2 etc.
at the end of the data line i have my main formula called calculate. This formula may or may may not populate all elements in the array. and uses whileprintingrecords.

my problem is that for example if element 2 is set to 1000 on a line, this value sometimes carries over to the next line. What can i do to ensure that each row of data starts of with an array that has been initialised properly?
 
You need to share the contents of your page header formula, one of your column formulas, and your calculation formula so we can see what you are doing. It would be helpful if you also provided a sample of the results you are getting and a sample of what you would like to see.

-LB
 
I think i found the answer
basically each column formula needs to read the value it requires from the array then set the array value back to 0 so the next row of data will have a zero'd array etc

here is the code
NumberVar Array values;
numbervar temp; /temp variable used to return value
whileprintingrecords;
temp:=0; / set temp to zero
temp:=values[1]; / set temp to value or array index 1
values[1]:=0; /set the array index 1 to zero
temp; return the temp variable

by doing this each column of data is responsible for resetting the array value it uses therefore the next line of data will have a blanked array
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top