Friday, February 24, 2012

Array manipulation

Hey all

I have a crystal report
I have a field in the database in table "1" that is a clob and stores codes separated by commas (e.g "1,343,4546,57657,67567,767,")

Then I have table "2" that has multiple records with the codes above in separate records
(e.g.
record 1 = 2
record 2 - 343
)

But not all codes are necessarily in table 2

So i want to separate the codes and show the ones that are not in table 2 as opposed to table 1

I created a formula field that has some manipulation
----------------
StringVar suppCodes:={table1.field(clob)};
stringvar array sort;
sort:=split(suppCodes, ",");

stringVar notresponded := "";
stringVar notr = "";

numberVar i ;

for i:=1 to ubound(sort) do(
if {table2.field} <> sort[i] then
notresponded := notresponded + " " + {table2.field}
)
------------------

But it is returning True and not the string notresponded

I want it to show me the string notresponded

Please someone helpSpot the difference:

stringVar notr = "";

stringVar notr := "";|||Didnt work cos I already dont use that var|||OK, then make it return notresponded, e.g.

for i:=1 to ubound(sort) do(
if {table2.field} <> sort[i] then
notresponded := notresponded + " " + {table2.field}
);

notresponded

Note the semicolon after the )
Should still fix the assignment though :)

No comments:

Post a Comment