Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Array problem Post Reply Post New Topic
Author Message
r140396
Newbie
Newbie
Avatar

Joined: 16 Sep 2007
Location: United States
Online Status: Offline
Posts: 6
Quote r140396 Replybullet Topic: Array problem
    Posted: 24 Jun 2008 at 12:57pm
I'm trying to use an array to populate multiple values on my report, but it is only populating the last value in the array.
 
Shared StringVar Array strDxCodes := MakeArray({Query1.CLCL_ID}, {Query1.IDCD_ID});
Local NumberVar iIndex := 0;
Local StringVar strDxList := "";
for iIndex := 1 to UBound(strDxCodes) do
(
    if strDxCodes[iIndex] <> "" then
    (
        Local StringVar Array strDxCodes := split(replace(strDxCodes[iIndex], "'", ""),
".");
        if strDxCodes[1] = {CLM153_CLMS.Claim Identifier} then
        (
            strDxList := strDxList & strDxCodes[2] & chr(10);
        );
    );
);
strDxList;
 
I don't think the carriage return chr(10) works, is there anything else I can use for a carriage return.
 
Can't see the problem, Help.


Edited by r140396 - 24 Jun 2008 at 2:22pm
Golfer Girl
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 24 Jun 2008 at 2:26pm
When you call MakeArray it initializes the array. Thus clearing out any previous values. You should put this declaration in its own formula that only gets called at the beginning of the report (ReportHeader possibly). If you wish to change the size of an array, use 'Redim Preserve' to keep the previous values intact.
 
I have extensive coverage of using arrays in reports, with sample code, in my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 24 Jun 2008 at 2:29pm
Oh yeah - try using carriage return + line feed
CHRW(10) + CHRW(13)
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.015 seconds.