Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a column (ColumnName) in some table with values:
A
B
C
...
Z
And i want to put all of the values into the variable (vValues), to get comma separated values in one string like this:
vValues = 'A,B,C,...,Z'
How can i do this? Tried 'concat' but unfortunately it does not work 😞
Hello,
you should make a loop and use the function peek().
Somethinkg like this
for N=0 to NoOfRows('TableName')-1
let vValue$(N)=peek('fieldName',N,'TableName')
next;
and concat all values.
J.
Hello,
you should make a loop and use the function peek().
Somethinkg like this
for N=0 to NoOfRows('TableName')-1
let vValue$(N)=peek('fieldName',N,'TableName')
next;
and concat all values.
J.
Hi,
Do simply..
in variable overview > add variable > vVariable and value
=concat(fieldname,',');
i think this is enough...
YOU JUST TRY front end ...
in edit script using end and using "LET"
You need an aggregation-load for it if you want to do it in the script, like:
t: load concat(Field) as ConcatField from source;
and the you could pick the value from the table, like:
LET vValues = peek(ConcatField,0, 't');
What is the aim for this list?
- Marcus
Aim of the list is future list of column names for crosstable.
Finaly my request looks like:
CrossFields:
LOAD
ColumnName
Resident tmp2;
LET CrossFieldsList = Concat(ColumnName,',','CrossFields');
And after reloading data i see CrossFieldsList as empty variable.
Looks like the loop is the better way to get the string. Thanks a lot!
I use this code:
FOR i = 0 TO FieldValueCount('ColumnName')-1
LET CrossFieldsList = IF(CrossFieldsList='','',CrossFieldsList & ',') & '[' & Peek('ColumnName',i,'CrossFields') & ']';
NEXT i;