Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
azimabadi
Contributor II

How to qualify a String?

Hi all,

i have a string field, let's assume 'Name':

Name         Age
----------------------

Tobias      20

Richard     23

i wnat to use the concatenated Names in FOR...EACH...NEXT control.

my code looks like :

LOAD concat( Name , ',' ) as conNames

FROM ......

LET ConNames = Peek( 'conNames' );

result is :

     Tobias,Richard

but this doesn't work in FOR...EACH. i need something like:

'Tobias','Richard'

i tried :

LOAD concat( '''' & Name & '''' , ',' ) as conNames

but it doesn't work and i get error when runing script. i need a way to qualify the string value of Name with '.

Thank you all

4 Replies

How to qualify a String?

Hi,

     Try using Chr() function like below

    

LOAD chr(39) & concat( Name , Chr(39)& ','  chr(39)) & chr(39) as conNames

FROM ......

Celambarasan

azimabadi
Contributor II

Re: How to qualify a String?

thank you so much for advise,

i think the answer is :

LOAD concat( chr(39) & Name & Chr(39) , ',' ) as conNames

Re: How to qualify a String?

Hi,

     Yes.You can use like that also.

Celambarasan

Re: How to qualify a String?

Hi,

Even when the expression editor does not recognize the Chr() after the comma as second parameter, is likewise valid, and the following expression should work in any object or variable:

LOAD Chr(39) & Concat(Name, Chr(39) & Chr(44) & Chr(39)) & Chr(39) AS conNames

conNames should store now something like

'Peter','Mike','Anthony'

Hope that helps.

Miguel

Community Browser