Bill Crawley
November 25th, 2008, 09:46 AM
Hi All,
I have the following code behind a formula
local stringvar temp[6];
local numbervar pos = 1;
local numbervar arraypos = -1;
local stringvar output = "";
while (instr(pos,{PPMQ2GetPORep;1.DefaultDeliveryAddress},chr(13)) <> 0) do
(if instr(pos,{PPMQ2GetPORep;1.DefaultDeliveryAddress},chr(13)) <> 0 then
temp[arraypos + 1] = mid({PPMQ2GetPORep;1.DefaultDeliveryAddress},pos,instr(pos,{PPMQ2GetPORep;1.DefaultDeliveryAddress},chr(13)));
pos = instr(pos,{PPMQ2GetPORep;1.DefaultDeliveryAddress},chr(13));
);
The database field holds address details delimited with CR. Some of the lines may be blank. So here, I'm trying to loop the value looking for chr(13) to build up a temp array. After this, I will test each element to see if it's blank and if so then I do not output that line.
I keep getting an error on the 'While' line saying that the start position is ever zero or not an integer???? any ideas anybody
I have the following code behind a formula
local stringvar temp[6];
local numbervar pos = 1;
local numbervar arraypos = -1;
local stringvar output = "";
while (instr(pos,{PPMQ2GetPORep;1.DefaultDeliveryAddress},chr(13)) <> 0) do
(if instr(pos,{PPMQ2GetPORep;1.DefaultDeliveryAddress},chr(13)) <> 0 then
temp[arraypos + 1] = mid({PPMQ2GetPORep;1.DefaultDeliveryAddress},pos,instr(pos,{PPMQ2GetPORep;1.DefaultDeliveryAddress},chr(13)));
pos = instr(pos,{PPMQ2GetPORep;1.DefaultDeliveryAddress},chr(13));
);
The database field holds address details delimited with CR. Some of the lines may be blank. So here, I'm trying to loop the value looking for chr(13) to build up a temp array. After this, I will test each element to see if it's blank and if so then I do not output that line.
I keep getting an error on the 'While' line saying that the start position is ever zero or not an integer???? any ideas anybody