Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have an expression that seems to work in a text object but then doesn't when used in my script. Can someone suggest a solution and or explanation?
Problem:
I am trying to get a list delimited by ',' inside a variable so I can use it in some sql.
Here is the expression:
SET vMyVar =chr(39) & Concat(MY_FIELD, chr(39) & ', ' & chr(39)) & chr(39);
It blows up if you try to use LET instead of SET, but if it is copyed and pasted into a sheet object text it works fine...?
Thanks in advance for any help!
You need to use aggregation functions in the context of a table LOAD.
Try using something like this:
TMP:
LOAD chr(39) & Concat(MY_FIELD, chr(39)&','&chr(39) ) & chr(39) as ConcatTmp
Resident TEST;
LET vMyVar = peek('ConcatTmp',-1,'TMP');
drop table TMP;
Assuming MY_FIELD field is originating in table TEST in this sample.
using LET gives "script object line error"
You need to use aggregation functions in the context of a table LOAD.
Try using something like this:
TMP:
LOAD chr(39) & Concat(MY_FIELD, chr(39)&','&chr(39) ) & chr(39) as ConcatTmp
Resident TEST;
LET vMyVar = peek('ConcatTmp',-1,'TMP');
drop table TMP;
Assuming MY_FIELD field is originating in table TEST in this sample.
Thanks! It worked great!!!