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

How to: search value in row then update all related records (different column) based on KEY/ID?

Hi, how can I search for value 'Reject' (during QVD load) in column DESCR and if TRUE update STATUS to 'FAIL' for all records with same ID? Please see below table.
 
Also, I was thinking about using wildmatch, however, this would only update a single record:
If(WildMatch(DESCR, '*Reject*'), 'FAIL', STATUS) as STATUS
 
Current data set:                                                                Objective:
IDSTATUSDESCR  IDSTATUSDESCR
aaOKx  aaOKx
aaOKx  aaOKx
bbOKx  bbFAILx
bbOKReject  bbFAILReject
ccOKx  ccOKx

 

IF 'Reject' is found in column DESCR then change STATUS to 'FAIL' for all rows with the same ID (in this case BB)

Labels (2)
1 Solution

Accepted Solutions
Taoufiq_Zarra

@QlikV1  Maybe like :

Input_QVD:

LOAD * INLINE [
    ID, STATUS, DESCR
    aa, OK, x
    aa, OK, x
    bb, OK, x
    bb, OK, Reject
    cc, OK, x
];
left join 
load ID,MinString(DESCR) as NewStatus resident Input_QVD group by ID;


Final:

load ID,if(NewStatus='Reject','FAIL',STATUS) as STATUS,DESCR resident Input_QVD;

drop table Input_QVD;

output:

Capture.PNG

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

@QlikV1  Maybe like :

Input_QVD:

LOAD * INLINE [
    ID, STATUS, DESCR
    aa, OK, x
    aa, OK, x
    bb, OK, x
    bb, OK, Reject
    cc, OK, x
];
left join 
load ID,MinString(DESCR) as NewStatus resident Input_QVD group by ID;


Final:

load ID,if(NewStatus='Reject','FAIL',STATUS) as STATUS,DESCR resident Input_QVD;

drop table Input_QVD;

output:

Capture.PNG

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
QlikV1
Contributor II
Contributor II
Author

Thank you for your prompt feedback, works like a charm : )