[red]CRv9, DB2, WinXp[/red]
I'm trying to create a formula which will compare a text string to the first text string (value before the comma) of a .csv file and return the correct text string (value following the comma). Below is what I came up with (unfortunately I'm not experienced with loops) and while this does return the correct text string it isn't working the way I need it to and it's slow.
Here are the contents of the csv file and the formula.
The file {test_csv.French} contains the following:
Yes,Oui
No,Non
Alt ID,Autre ID
The formula @Translation contains the following:
whileprintingrecords;
stringVar vText := "Alt ID";
stringvar array times:={test_csv.French};
numbervar loops:=ubound(times);
numbervar a;
stringvar vOutPut;
for a:= 1 to loops do
(
if vText = split({test_csv.French},","[1] then vOutPut := split({test_csv.French},","[2],
a:=loops;
if vOutPut = "" then vText else
vOutPut;
);
vOutPut
This is what it's doing in the report:
record1 @Translation is blank
record2 @Translation is blank
record3 @Translation = Autre ID
record4 @Translation = Autre ID
record5, 6, 7..... @Translation = Autre ID
What am I doing wrong and how can I fix it? I also hope to use it for strings returned from the db as well. I was wondering about having a UFL created instead to do the comparison, return the text string and to improve the processing time.
Thanks,
Jacque
I'm trying to create a formula which will compare a text string to the first text string (value before the comma) of a .csv file and return the correct text string (value following the comma). Below is what I came up with (unfortunately I'm not experienced with loops) and while this does return the correct text string it isn't working the way I need it to and it's slow.
Here are the contents of the csv file and the formula.
The file {test_csv.French} contains the following:
Yes,Oui
No,Non
Alt ID,Autre ID
The formula @Translation contains the following:
whileprintingrecords;
stringVar vText := "Alt ID";
stringvar array times:={test_csv.French};
numbervar loops:=ubound(times);
numbervar a;
stringvar vOutPut;
for a:= 1 to loops do
(
if vText = split({test_csv.French},","[1] then vOutPut := split({test_csv.French},","[2],
a:=loops;
if vOutPut = "" then vText else
vOutPut;
);
vOutPut
This is what it's doing in the report:
record1 @Translation is blank
record2 @Translation is blank
record3 @Translation = Autre ID
record4 @Translation = Autre ID
record5, 6, 7..... @Translation = Autre ID
What am I doing wrong and how can I fix it? I also hope to use it for strings returned from the db as well. I was wondering about having a UFL created instead to do the comparison, return the text string and to improve the processing time.
Thanks,
Jacque