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

Array Issue

Status
Not open for further replies.

satinsilhouette

Instructor
Joined
Feb 21, 2006
Messages
625
I have an array set up to gather 2 sets of variables to fill and x and a y array. I don't have the detail section quite down, it is asking for a then on the if statement in XI R2. Thought you could leave it without a then piece to the statement. I am horrible at loops, how do I do this?

Reset grp hdr:
whileprintingrecords;
numbervar array x := 0;
datevar array y := date(0,0,0);
numbervar i := 0;
numbervar j := 0;

Detail:
whileprintingrecords;
numbervar array x;
datevar array y;
numbervar i := i + 1;
numbervar j := j + 1;


This is the piece I am having issues with for the detail section:
if i <= j then (
redim preserve x[j];
redim preserve y[j];
x := tonumber({numberfield});
y := datevalue({datefield})
);


grp ftr:

whileprintingrecords;
numbervar array x;
datevar array y;
xirr(x,y)


Thanks so much!
satinsilhouette
 
You set up the variable j incorrectly. You should have stuck with the original thread, too.

whileprintingrecords;
numbervar array x;
datevar array y;
numbervar i := i + 1;
numbervar j := count({table.anyrecurringfield},{table.groupfield});
if i <= j then (
redim preserve x[j];
redim preserve y[j];
x := tonumber({numberfield});
y := datevalue({datefield})
);

-LB
 
Thank you lbass, but it comes back with 'the word else is missing', which is where I was two days ago. So I am still stuck.

By the way, your help to this forum is invaluable. I don't get to deal with this stuff on a daily basis, or very often at all. It's nice to know you are still on this forum.

Thanks so much!
satinsilhouette
 
Please post the exact formula you are using.

-LB
 
I tried your exact array formula:
whileprintingrecords;
numbervar array x;
datevar array y;
numbervar i := i + 1;
numbervar j := count({Sheet1_.Client},({Sheet1_.Client}));
if i <= j then (redim preserve x[j];
redim preserve y[j];x := tonumber({Sheet1_.Account});
y := datevalue({Sheet1_.Date}));

I get 'The word else is missing' from it.

Thanks so much!
satinsilhouette
 
I hadn't noticed that you also made other mistakes. Please look back at the original thread. It should be:

whileprintingrecords;
numbervar array x;
datevar array y;
numbervar i := i + 1;
numbervar j := count({table.anyrecurringfield},{table.groupfield});
if i <= j then (
redim preserve x[j];
redim preserve y[j];
x[red][/red] := tonumber({numberfield});
y[red][/red] := datevalue({datefield})
);

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top