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

How do I search values within an Array

Status
Not open for further replies.

Colonel45

Technical User
May 18, 2011
1
US
I am trying to build a output string that contains the values from an input parm that was converted to a string 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}
 
Please show the content of {@Dept_Array}.

Also in what report section are you planning to place the new formula, and what is its purpose?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top