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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
MagnusRydberg1
Partner - Contributor III
Partner - Contributor III

Create a list from a Table

Jag have a table(FuelType) med with different fuel types,  I want to create a list (Fueltypelist) with the different fuel types seperated with '|'.

 

Have tried this but it doesn't work

Validfueltype:

LOAD

    ID as v_FuelTypeID,

    Name as v_FuelTypeName

    FROM [lib://QlikDataQVD/MyC/MYCQVDSTORE/LSP/FuelType.qvd]

   (qvd);

 

Let LoopNumber=1;

For LoopNumber= 1 to NoofRows('Validfueltype')

LET Fueltypelist=Peek('v_FuelTypeName', LoopNumber-1,Validfueltype)+ '|'+Fueltypelist;

Next;

 

Labels (3)
1 Solution

Accepted Solutions
JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @MagnusRydberg1 

If the expression in the back end is 

Chr(39) & Concat(Distinct Fueltype, '|') & Chr(39) as List

Then just doing a =List should work... 

Im replying on my mobile so not close to a laptop now to test this. Alternatively you can do 

Concat(Distinct Fueltype, '|') as List and in the front end do 

='$(=List)' 

Regards Jandre

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

View solution in original post

12 Replies
JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @MagnusRydberg1 

Validfueltype:
LOAD

    ID as v_FuelTypeID,

    Name as v_FuelTypeName

    FROM [lib://QlikDataQVD/MyC/MYCQVDSTORE/LSP/FuelType.qvd]

   (qvd);
   
List:   
Load 
	Concat(Distinct v_FuelTypeName, '|') as List
Resident Validfueltype;

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

MagnusRydberg1
Partner - Contributor III
Partner - Contributor III
Author

Thank a lot! It worked! 

But I also want the list to start and end with the ' character

I tried this but it didn't work (See Fueltypelist2 below):

// Valid Fuel type
Validfueltype:
LOAD
ID as v_FuelTypeID,
Name as v_FuelTypeName
FROM [lib://QlikDataQVD/MyC/MYCQVDSTORE/LSP/FuelType.qvd]
(qvd);

Fueltypelist1:
Load
Concat(Distinct v_FuelTypeName, '|') as Fueltypelist1
Resident Validfueltype;

chr(39) + Fueltypelist1 + chr(39 as Fueltypelist2;

ramchalla
Creator II
Creator II

Hi Magnus,

Please try this

Fueltypelist1:
Load
Concat(chr(39)& Distinct v_FuelTypeName&chr(39), '|') as Fueltypelist1
Resident Validfueltype;

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @MagnusRydberg1 

List:

Load
Concat(Distinct chr(39)&v_FuelTypeName&chr(39), '|') as List
Resident Validfueltype;

 

This will give you 'value1'|'value2' etc etc.

I assume this for a variable input that you want to use in the front end... If so, there is a "better" way. Let me know

 

Regards Jandre

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

MagnusRydberg1
Partner - Contributor III
Partner - Contributor III
Author

Hi Jandre,

Thanks for your help. Yes it for use in the front end. I want the list to be:

'value1|value2|value3' etc. 

 

 

Best regards

// Magnus

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @MagnusRydberg1 

 

Exactly what I thought. Hahah

For the back end you can do it like this

Load

Chr(39)& Concat(Distinct v_FuelTypeName, '|')&chr(39) as List

Resident Validfueltype;

 

But on the front end you can create another variable or just in the dynamic fx box of where you would put the List field (created above) enter this

={1} Chr(39)& Concat(Distinct v_FuelTypeName, '|')&chr(39)

It would be the same result and you dont need to perform a reload. 

Let me know

Regards Jandre

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

MagnusRydberg1
Partner - Contributor III
Partner - Contributor III
Author

It seems that the list should be OK now but the list doesn't show up in the front end...:

MagnusRydberg1_0-1738602391603.png

 

What am I doing wrong in the front end?

Thanks again

// Magnus

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @MagnusRydberg1 

Just use it like this 

=Fueltypelist1

That should work.

Regards Jandre 

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

MagnusRydberg1
Partner - Contributor III
Partner - Contributor III
Author

Sorry but =Fueltypelist1 it shows:

MagnusRydberg1_0-1738603116448.png

But if I Use this direct in frontend unde f(x) it works! 🙂

={1} Concat(Distinct v_FuelTypeName, '|')

Best regards

// Magnus

 

But if I