Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Searching and Array Post Reply Post New Topic
Author Message
Colonel45
Newbie
Newbie


Joined: 10 May 2011
Location: United States
Online Status: Offline
Posts: 35
Quote Colonel45 Replybullet Topic: Searching and Array
     Posted: 18 May 2011 at 8:38am
I have the following code that I am using to build a string based on values of an array:
 
local stringVar array a := {@Dept_Array};
local numbervar b:=1;
Global Stringvar DeptString;
for b:=1 to ubound(a)
do
if left(a,7) = "5000001"
    then DeptString:= DeptString + 'Public Consulting Group' + chrw(13)
else if left(a,7) = "5000002"
    then DeptString:= DeptString + 'Health And Human Services' + chrw(13)
else if left(a,7) = "5000006"
    then DeptString:= DeptString + 'Education' + chrw(13)
else if left(a,7) = "5000008"
    then DeptString:= DeptString + 'Corporate '  + chrw(13)
else if left(a,7) = "5000012"
    then DeptString:= DeptString + 'IT' + chrw(13)
else if left(a,7) = "5000741"
    then DeptString:= DeptString + 'CRM' + chrw(13)
else if left(a,7) = "5000961"
    then DeptString:= DeptString + 'Technology Consulting' + chrw(13)
else
    DeptString :=    'Corporate' + cstr(ubound(a)) + chr(13) + chr(10) +
                     'Education' + chr(13) + chr(10) +
                     'Enterprise Architecture Solutions' + chr(13) + chr(10) +
                     'Enterprise Program Services' + chr(13) + chr(10) +
                     'Enterprise Technology Solutions' + chr(13) + chr(10) +
                     'Health & Human Services' + chr(13) + chr(10) +
                     'IEP Online' + chr(13) + chr(10) +
                     'IT' + chr(13) + chr(10) +
                     'LTI' + chr(13) + chr(10) +
                     'Pacific North West' + chr(13) + chr(10) +
                     'Project Management Solutions' + chr(13) + chr(10) +
                     'Public Consulting Group' + chr(13) + chr(10) +
                     'Quality Solutions' + chr(13) + chr(10) +
                     'Technology Consulting';
DeptString
 
 
But for some reason if the {@Dept_Array} has more than one value then the DeptString only shows the value that fulfills the if/else statement first. It won't show more than one department only the one that hits first. I need it to build a output string with all the values inside the {@Dept_Array}
IP IP Logged
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