Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I have value's field from which I want create variable values separated by comma.
For example, field with values "B","A","C","E","J". Variable = B,A,C,E,J
How can I get this through load script?
Thanks!
This is an efficient way of doing it:
SomeValues: // JUST TO HAVE SOME TABLE/FIELD TO TEST IT AGAINST....
LOAD * INLINE [
Value
A
B
UU
O
P
C
F
G
H
];
ConcatenatedValues:
LOAD
Concat( Value , ',' ) AS ConcatenatedValue
RESIDENT
SomeValues;
vConcatenatedValues = Peek('ConcatenatedValue');
DROP TABLE ConcatenatedValues;
try something like this, it uses the ASCII codes for commas and double quotes.
Let Variable2 =chr(34) & replace(Variable, chr(44), chr(34)chr(44)chr(34) ) & chr(34) ;
a:
load * inline [
field
"a"
"b"
"c"
"d"
"e"
"f"
];
load concat(PurgeChar(field,'"'), ',') as newfield Resident a;
let var=Peek('newfield');
This is an efficient way of doing it:
SomeValues: // JUST TO HAVE SOME TABLE/FIELD TO TEST IT AGAINST....
LOAD * INLINE [
Value
A
B
UU
O
P
C
F
G
H
];
ConcatenatedValues:
LOAD
Concat( Value , ',' ) AS ConcatenatedValue
RESIDENT
SomeValues;
vConcatenatedValues = Peek('ConcatenatedValue');
DROP TABLE ConcatenatedValues;
Oops - I'm doing it the wrong way round - adding the quotes!
That's it, Petter!
Thanks everyone!