Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Replace the values

Capture.JPG

I wanted to replace the values in my script .The value fields in Severity table were 1,2,3,4 I want to replace the same with High','Medium','Low','very Low'I changed severity in Load as    pick(match(Severity,'1','2','3','4'),'High','Medium','Low','very Low') .The output is as shown above.Can you let me know how can i replace all the values in severity columns with names? or is there any other method?

LOAD id,

  tktid,

  CreateDate,

  Updaterid,

  Name,

  EngagementType,

   pick(match(Severity,'1','2','3','4'),'High','Medium','Low','very Low') ,

    BIZHrMinBetween,

  SLA,

  ticketform,

  Coverage,

  CalMinBetween,

  old_sla;

[ticket_status_sla]:

SELECT id,

  tktid,

  CreateDate,

  Updaterid,

  Name,

  EngagementType,

  ServiceType,

  Severity,

  BIZHrMinBetween,

  SLA,

  ticketform,

  Coverage,

  CalMinBetween,

  `old_sla`

FROM `ticket_status_sla`;

7 Replies
Gysbert_Wassenaar

[ticket_status_sla]:

LOAD id,

  tktid,

  CreateDate,

  Updaterid,

  Name,

  EngagementType,

   pick(Severity,'High','Medium','Low','very Low') as Severity,

    BIZHrMinBetween,

  SLA,

  ticketform,

  Coverage,

  CalMinBetween,

  old_sla;

SELECT id,

  tktid,

  CreateDate,

  Updaterid,

  Name,

  EngagementType,

  ServiceType,

  Severity

  BIZHrMinBetween,

  SLA,

  ticketform,

  Coverage,

  CalMinBetween,

  `old_sla`

FROM `ticket_status_sla`;


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

The code is not working ,Are you sure the changes have to be under select ID AND NOT load ?

sunny_talwar

Can you try this:

LOAD id,

  tktid,

  CreateDate,

  Updaterid,

  Name,

  EngagementType,

  Pick(Severity * 1,'High', 'Medium', 'Low', 'Very Low') as Severity,

  BIZHrMinBetween,

  SLA,

  ticketform,

  Coverage,

  CalMinBetween,

  old_sla;

SELECT id,

  tktid,

  CreateDate,

  Updaterid,

  Name,

  EngagementType,

  ServiceType,

  Severity,

  BIZHrMinBetween,

  SLA,

  ticketform,

  Coverage,

  CalMinBetween,

  `old_sla`

FROM `ticket_status_sla`;

Not applicable
Author

Hi Sunny,

It dosent work as well.It is giving the same output as mentioned above.Also,We need to specify which values to replace.I think it can be done by if statement to .

sunny_talwar

Is there another table where you might have Severity which need a similar Pick() statement?

Anonymous
Not applicable
Author

Please try the following:

   If( Match( [your_value_field] , 1), 'High',   

        If(Match( [your_value_field], '2'), 'Medium',

             If(Match( [your_value_field], '3'), 'Low', 'very Low')

          )

     ) as your_replace_field ,

Not applicable
Author

Hi Haikuo,

The code is working fine if I am using different names for "your_value_field" and "your_replace_field".

If( Match( [Severity] , 1), 'High',  

        If(Match( [Severity], '2'), 'Medium',

             If(Match( [Severity], '3'), 'Low',

             If(Match( [Severity], '4'),'vl')

          ))

     ) as SeverityNew,

This is making  new field.I want to replace the data in the severity table.

If I am using the SeverityNew as Severity  the code is still showing output as attached in the question above.