Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Adapting multiple records with underscore

Dear all,

I have two tables which I would like to link to one another, but one of them contains underscores and the other one does not.

NameAge
John Doe40
Peter Parker41
Jane Doe42

NameWeight
John_Doe50
Peter_Parker60
Jane_Doe70

I prefer not to change them one by one in the code in case new records are added.

What is the syntax for removing the underscores in the Qlik Sense data load editor?

Thanks for your help.

1 Solution

Accepted Solutions
MVP
MVP

Re: Adapting multiple records with underscore

So here is a way to do it in Qlik Sense:

2015-05-06 #2.PNG

2015-05-06 #3.PNG

2015-05-06 #4.PNG

9 Replies
datanibbler
Esteemed Contributor

Re: Adapting multiple records with underscore

Hi,

does QlikSense have the REPLACE() function?

If so, just replace BLANKs in that field with an underscore -> create a new field.

Then

- drop the old field using DROP FIELD ... FROM ...

- rename the new field to the old fieldname using RENAME FIELD ... TO ...

HTH

Not applicable

Re: Adapting multiple records with underscore

Thanks for your reply, but unfortunately the Replace function is not supported by Qlik Sense.

datanibbler
Esteemed Contributor

Re: Adapting multiple records with underscore

Hi,

oops. That was dropped? Stupid ... well, then you can do it otherwise.

Do you have the Subfield() function?  Then you could try like

>> Subfield([name], ' ', 1) & '_' & Subfield([name], ' ', 2 <<

If that has been dropped, too - do you have the INDEX() function (to tell you the position of one character within a string?

Not applicable

Re: Adapting multiple records with underscore

Hi,

thanks, the Subfield() function works and I understand what it does. Do you know how I should iterate through the data in order to apply this to every record in the name column?


MVP
MVP

Re: Adapting multiple records with underscore

Replace function is still supported... both in scripts and charts/UI

Not applicable

Re: Adapting multiple records with underscore

Are you sure? This is what I got when I entered Replace and clicked the question mark:

http://help.qlik.com/sense/en-US/online/#../Subsystems/Hub/Content/Scripting/QlikViewFunctionsStatem...

Replace                                    

This command is only relevant during partial reload, which is not supported in Qlik Sense.

I work with Qlik Sense 1.1 which I believe is the newest version. If you are sure it works I will try it out.

MVP
MVP

Re: Adapting multiple records with underscore

There are two "Replace" keywords in script syntax:

- Replace() function

- Replace prefix to a Load statement

We are referring to the first - which is a function to replace parts of a string with some other string.

You are talking about REPLACE LOAD .... which is something entirely different ...

MVP
MVP

Re: Adapting multiple records with underscore

So here is a way to do it in Qlik Sense:

2015-05-06 #2.PNG

2015-05-06 #3.PNG

2015-05-06 #4.PNG

Not applicable

Re: Adapting multiple records with underscore

Thanks for your elaboration!

Community Browser