Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Replace field value, if condition

Hi,

I have a table in which I want to replace certain field names subject to one condition. I have a table with three fields as below. I want to replace the field value in Identifier with Identifier 2 if the activity is Abnormal or Insufficient. The result table is found below in which I added the changes in bold font. Thank you in advance!

Initial table:

IdentifierActivityIdentifier 2
123Normal321
1234Normal4321
12345Abnormal54321
123456Insufficient654321

Result table:

IdentifierActivityIdentifier 2
123Normal321
1234Normal4321
54321Abnormal54321
654321Insufficient654321
1 Solution

Accepted Solutions
Not applicable

Re: Replace field value, if condition

Untested syntax.

LOAD

     if(Activity = 'Abnormal' or Activity = 'Insufficient', [Identifier 2], Identifier) as Identifier,

     ....

FROM.

     ...

4 Replies
Not applicable

Re: Replace field value, if condition

Untested syntax.

LOAD

     if(Activity = 'Abnormal' or Activity = 'Insufficient', [Identifier 2], Identifier) as Identifier,

     ....

FROM.

     ...

manojkulkarni
Valued Contributor II

Re: Replace field value, if condition

Load

if(Activity='Abnormal' or Activity='Insufficient', Identifier2,Identifier) AS Identifier

Activity,

Identifier2

From Table1..

vardhancse
Valued Contributor II

Re: Replace field value, if condition

Yes, for Identifier we can make a condition instead of direct field.

if(Activity='Abnormal' or Activity ='Insufficient', Identifier2,Identifier) as Identifier,

This will check the Activity values if satisfies any one then identify2 value will be place for Identifier, if not Identifier value will be placed

Not applicable

Re: Replace field value, if condition

Thanks everyone! Such a simple answer. Cheers!

Community Browser