Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
davyqliks
Specialist
Specialist

If Value from a list = value from another list

Hi experts,

 

I wonder if you can help.

I have a list of items and a lookup with some of those items within it. I need to assign correct,error based on if there is a match. i have the same for price and size. so i tried the following but it is not returning the expected in my test:

If( ItemLookup =Items , 'Correct', 'Error') as ItemCheck,
If( "Size Conf" = EDISize , 'Correct', 'Error') as SizeCheck,
If( "Price Conf" = EDIPrice , 'Correct', 'Error') as PriceCheck

 

Should this work?

Thank you

Daniel

 

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

I think your script should work. Take a look at my sample script below:


LOAD
rowno() as ID,
ItemLookup, Items,
If( ItemLookup =Items , 'Correct', 'Error') as ItemCheck,
[Size Conf], EDISize,
If( "Size Conf" = EDISize , 'Correct', 'Error') as SizeCheck,
[Price Conf], EDIPrice,
If( "Price Conf" = EDIPrice , 'Correct', 'Error') as PriceCheck

inline [
ItemLookup, Items, Size Conf, EDISize,Price Conf, EDIPrice
TOM H TML1, TOM H TML1, 15, 15, 18, 18
TOM H TML1, TOM H TML2, 15, 14, 18, 17
];

It will return this output:

Vegar_0-1646922023750.png

If you have trouble you could try to trim your fields before comparing. 

If( trim(ItemLookup) =trim(Items) , 'Correct', 'Error') as ItemCheck,
If( trim("Size Conf") = trim(EDISize) , 'Correct', 'Error') as SizeCheck,
If( trim("Price Conf") = trim(EDIPrice) , 'Correct', 'Error') as PriceCheck

 

View solution in original post

4 Replies
Chanty4u
MVP
MVP

try this

If( ItemLookup ='Items' , 'Correct', 'Error') as ItemCheck,
If( "Size Conf" ='EDISize' , 'Correct', 'Error') as SizeCheck,
If( "Price Conf" ='EDIPrice', 'Correct', 'Error') as PriceCheck

 

 

davyqliks
Specialist
Specialist
Author

thank you for the response,

I tried this and i still get error where i would expect correct

davyqliks_1-1646920883800.png

 

davyqliks_0-1646920792902.png

 

Daniel

 

Vegar
MVP
MVP

I think your script should work. Take a look at my sample script below:


LOAD
rowno() as ID,
ItemLookup, Items,
If( ItemLookup =Items , 'Correct', 'Error') as ItemCheck,
[Size Conf], EDISize,
If( "Size Conf" = EDISize , 'Correct', 'Error') as SizeCheck,
[Price Conf], EDIPrice,
If( "Price Conf" = EDIPrice , 'Correct', 'Error') as PriceCheck

inline [
ItemLookup, Items, Size Conf, EDISize,Price Conf, EDIPrice
TOM H TML1, TOM H TML1, 15, 15, 18, 18
TOM H TML1, TOM H TML2, 15, 14, 18, 17
];

It will return this output:

Vegar_0-1646922023750.png

If you have trouble you could try to trim your fields before comparing. 

If( trim(ItemLookup) =trim(Items) , 'Correct', 'Error') as ItemCheck,
If( trim("Size Conf") = trim(EDISize) , 'Correct', 'Error') as SizeCheck,
If( trim("Price Conf") = trim(EDIPrice) , 'Correct', 'Error') as PriceCheck

 

davyqliks
Specialist
Specialist
Author

I see you have this working as expected, thank you, i will start to strip back the tables and see where the issue is arising.

Thank you so much for taking the time to look at this and show your findings.

 

Regards,

Daniel