Create a loop to count how many occurances of ',' there are and add 1 to determine how many variables there are. This formula was edited from something I found on this site that lockwelle created:
local numbervar iComma := instr({Events.PassOnBoard, ',');
local numbervar iCount:=0;
while iComma <> 0 do
(
if iComma <> 0 then iCount := iCount + 1;
iComma:= instr(iComma + 1, {Events.PassOnBoard}, ",")
);
iCount;
Name it whatever you want, for this post it will be {CommaCount}.
Then you can create 5 formulas similar to this:
First Variable Formula
if not isnull({Events.PassOnBoard})
then left({Events.PassOnBoard}, 4)
else ''
//You can use this since the first one does not rely on a comma
//and since there may be no comma if only one variable.
Second Variable Formula
if ',' in {Events.PassOnBoard}
and {CommaCount}>0
then split({Events.PassOnBoard}, ',')[2]
else ''
Third Variable Formula
if ',' in {Events.PassOnBoard}
and {CommaCount}>1
then split({Events.PassOnBoard}, ',')[3]
else ''
Edited by FrnhtGLI - 17 Nov 2010 at 2:21am