Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rename records based on values

Is there a way in the script to rename records based on values.  i.e. in the field 'Type', I want any 1 to equal 'Private', 2 to equal 'General', etc.

Thank you!

1 Solution

Accepted Solutions
sunny_talwar

Did you add semi-colon (;) after  ] at the end?

FromTo:

Mapping

LOAD * Inline [

From, To

1,General PII

2,Sensitive PII

3,Financial Information

4,Medical Information

5,Multiple Types

];

View solution in original post

17 Replies
Anonymous
Not applicable
Author

Have a look at the ApplyMap() function.

This Blog Post Joins and Lookups explains it as well as a few other things.

sergiorey
Partner - Creator
Partner - Creator

Hi Tyler,

You can do it this way:

If([Type]=1, 'Private', If([Type]=2, 'General', [Type]))          As [Type]

Hope it helps.

Regards,

Sergio.

sunny_talwar

Try this:

Pick(Match(Type, 'Private', 'General'), 1, 2) as NewType

eduardo_sommer
Partner - Specialist
Partner - Specialist

Use an ApplyMap function

First, load the table with the from/to columns

FromTo:

Mapping load * inline [

From, To

1, Private

2, General

...

...

];

Table:

Load

      Field1,

      Field2,

     ApplyMap('FromTo', Type, 'Default Value') as Type,

...

...

From ...;  

Eduardo

Anonymous
Not applicable
Author

None of these are working unfortunately. 

It tells me that it does not recognize the 'Type' field when I apply these methods.  Any other thoughts?

sergiorey
Partner - Creator
Partner - Creator

Is it working when loading "Type" field without transformations?

sunny_talwar

So you don't have a field called Type. What is the name of the field that contains Private, General etc?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Can you post your script?

MarcoWedel

Hi,

I guess this thread is related to your previous thread: Count total of 1s, 2s, 3s, 4s, and 5s in single expression

So maybe you are having a field [Type of PII] instead you could use in those expressions?

hope this helps


regards


Marco