Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Adding another data set to an array Post Reply Post New Topic
Author Message
bmcnary1
Newbie
Newbie
Avatar

Joined: 23 Oct 2012
Online Status: Offline
Posts: 17
Quote bmcnary1 Replybullet Topic: Adding another data set to an array
    Posted: 30 Mar 2014 at 7:27am
Hi All,

I'm trying to add in the terminal value number to array and am having difficulty. I'm using this array for an XIRR calc. XIRR calc's in crystal require a value and a date array set up. In this calculation, I need net contributions/distributions (which have 34 records) and then I need to add to the value/date section the terminal value which is only one number.

The formula I'm using (below) works, but it duplicates the first number in the array.

WhilePrintingRecords;
datetimevar array d;
numbervar array n;

numbervar x:= x + 1;
redim preserve d[x];
redim preserve n[x];
d[x]:= DateValue({Main.GL Date});
n[x]:= ToNumber({Main.Net Investor Contributions / Distributions});

//append arrays with terminal value
if onlastrecord then
(
x:= x + 1;
redim preserve d[x];
redim preserve n[x];
d[x]:= DateValue({PCAP.GL Date});
n[x]:= ToNumber({PCAP.Ending Capital});
);

The only logic that I think would remove the duplicate is by saying that IF NetContrib/Dist = NEXT Contrib Distib and GL Date = Next GL Date, then suppress. To be honest though, my array skills are very limited.

Does anyone have any thoughts on how to do this? I'd greatly appreciate it!

Regards,
Brandon

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 02 Apr 2014 at 5:04am
is it only the first value, or are all values the same?
did you initialize x to 0 at the start of the report?
 
arrays are pretty limited in CR, so I don't use them too much. The syntax looks correct, so these are the first questions that come to mind
 
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.000 seconds.