Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
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
MVP & Luminary
MVP & Luminary

Re: Replace the values

[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

Re: Replace the values

Hi Gysbert,

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

Re: Replace the values

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

Re: Replace the values

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 .

Re: Replace the values

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

datalakeyu
Valued Contributor

Re: Replace the values

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

Re: Replace the values

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.