Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variables Values Generated Through Load Script

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!

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

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;

View solution in original post

5 Replies
Colin-Albert
Partner - Champion
Partner - Champion

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) ;

maxgro
MVP
MVP

a:

load * inline [

field

"a"

"b"

"c"

"d"

"e"

"f"

];

load concat(PurgeChar(field,'"'), ',') as newfield Resident a;

let var=Peek('newfield');

petter
Partner - Champion III
Partner - Champion III

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;

Colin-Albert
Partner - Champion
Partner - Champion

Oops - I'm doing it the wrong way round - adding the quotes!

Not applicable
Author

That's it, Petter!

Thanks everyone!