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: 
xyz123451
Contributor II
Contributor II

Renaming certain values in a field based on multiple conditions

Hello, I am looking to rename the Sess_name value to S_Pa001 if Wf_name is Wf_Pa001 and S_Sw002 if Wf_name is Wf_Sw002 in the data loading script. WIll it be possible to do it? Thanks.

Table A

Wf_name Sess_name
Wf_Pa001 S_FHG_1
Wf_Sw002 S_GHI_1
Wf_Pa002 S_HJIL_1
Wf_PA003 S_UJIO_1

 

Table B (Output Table)

Wf_name Sess_name
Wf_Pa001 S_Pa001
Wf_Sw002 S_Sw002
Wf_Pa002 S_HJIL_1
Wf_PA003 S_UJIO_1
Labels (3)
3 Replies
Javizh
Partner - Contributor III
Partner - Contributor III

Hello @xyz123451 

You can achieve that in multiple ways:

  • With nested Ifs
  • With Pick and Match functions
  • With a mapping table

I recomend thye 3rd one, as it is much easier to add new names you want to change in the future.

Attached is the QVF with the 3 options

Hope its helpful

Best regards

xyz123451
Contributor II
Contributor II
Author

Hello! Will it be possible to paste it in the reply directly? I am currently on mobile now and won’t have access to Qliksense these few days. Thank you!

Javizh
Partner - Contributor III
Partner - Contributor III

Hello @xyz123451 

Here you go:

 

 

Map_Wf_name:
Mapping Load * inline [
Wf_name ,NewSessName
Wf_Pa001 ,S_Pa001
Wf_Sw002 ,S_Sw002
];
 
 
 
Data:
Load 
*,
    IF(Wf_name = 'Wf_Pa001',
    'S_Pa001',
    IF(Wf_name = 'Wf_Sw002',
        'S_Sw002'
            ,Sess_name
        )
     ) as NewSess_name,
     PICK(MATCH(Wf_name,'Wf_Pa001','Wf_Sw002')+1,Sess_name,'S_Pa001','S_Sw002') as NewSess_name2,
     ApplyMap('Map_Wf_name',Wf_name,Sess_name) as NewSess_name3
inline [
Wf_name ,Sess_name
Wf_Pa001 ,S_FHG_1
Wf_Sw002 ,S_GHI_1
Wf_Pa002 ,S_HJIL_1
Wf_PA003 ,S_UJIO_1
]