Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Update field value if match criteria

Hi,  i try to update field value by using if statment, however after reload. the data still show unknown......

(conditions: value update only if the key between two table is the same)

Cost Center:

CostCode & '|' & Nature as CN,

CostCode,

nature

Table_temp:

NoConcatenate

load *, CostCode & '|' & Nature as CN

Resident TableA;

DROP Table TableA;

Table_final:

NoConcatenate

load *,

if(PartClass='C',

   if(ControlDepartment='Unknown','AM')),

if(PartClass='E',

   if(ControlDepartment='Unknown','AM'))

Resident Table_temp;

DROP Table Table_temp;

Please advice. Many thanks

Mic

7 Replies
Anonymous
Not applicable
Author

You are not calling the field anything. For instance:

Table_final:

NoConcatenate

load *,

if(PartClass='C',

   if(ControlDepartment='Unknown','AM')),

if(PartClass='E',

   if(ControlDepartment='Unknown','AM')) AS TheField

Resident Table_temp;

DROP Table Table_temp;

Jonathan

Not applicable
Author

The field i would like to update which is ControlDepartment. It is already exist at the QVW. Any advise?

Mic

Sokkorn
Master
Master

Hi Mic,

Can you try this and let me know

If(Match(PartClass,'C','E'),If(ControlDepartment='Unknown','AM'))    AS Field

Regards,

Sokkorn

Not applicable
Author

I try the statement and  return messgae 'Fields name within the table must be unique'

in my case, i would like to update existing field base on conditions statment, {if A.table ID=B.table ID) and A,PartClass=C or E, then update the target fields }rather than create alias field,

In qlikview, is it possible to doing so? If it is SQL database, i can use update statement to solve it, however, i am confuse with the Qlikview environment.

Besides, how can i achieve value

Please advise. Thanks you very much

Mic

Anonymous
Not applicable
Author

If the field is already in the table then the statement would not add it back in.

Create a new field with a new name (e.g. NewControlDepartment). Then do another Left join in which you test  whether you want to use the existing ControlDeparment or the NewControlDepartment fields, calling it something else (e.g. TheControlDepartment). You can then drop the other two fields.

Jonathan

Not applicable
Author

thank you very much and i i will have a  try.

Anonymous
Not applicable
Author

Did it work ? Please mark solved if it did.

Jonathan