Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
alexis
Partner - Specialist
Partner - Specialist

Help with string building

Hi

I have an Excel spreadsheet that contains a column of numbers (e.g. 8418, 8423, 8424,8424, 8447 ....)

I want to read this list in order to create a string of the order:

'8418*', '8423*', '8424*','8424*','8447*'

i.e. each number will have a * after it and each set enclosed in single quotes as shown and separated by a comma.

I made a start as follows:

Codes:

LOAD chr(39) & A & '*' & chr(39) As Value

FROM

CommodityCodes.xlsx

(ooxml, no labels, table is Sheet1);

How do I build a string from the table and lose the last comma?

Any ideas would be very welcome.

Regards

Alexis

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try

CodeList:
LOAD concat(chr(39) & A & '*' & chr(39), ',') As ValueList
FROM
CommodityCodes.xlsx
(ooxml, no labels, table is Sheet1);


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Try

CodeList:
LOAD concat(chr(39) & A & '*' & chr(39), ',') As ValueList
FROM
CommodityCodes.xlsx
(ooxml, no labels, table is Sheet1);


talk is cheap, supply exceeds demand
alexandros17
Partner - Champion III
Partner - Champion III

let

yyy='';



for i = 0 to NoOfRows('Codes')-1

 
xxx= Peek('Value', $(i), 'Codes') ;

yyy = yyy & ',' & xxx;



NEXT



let zzz = mid(yyy,2);

alexis
Partner - Specialist
Partner - Specialist
Author

Thank you Gysbert.

The complete solution is:

CodeList:

LOAD concat(chr(39) & A & '*' & chr(39), ',') As ValueList

FROM

CommodityCodes.xlsx

(ooxml, no labels, table is Sheet1);

Let vSearch = Peek('ValueList',0,'CodeList');

Thanks

Alexis