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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

if condition is not working

I have data looks like below





t:

LOAD

* INLINE [



VBELN,OBJNR,OBJNR1,Flag

'1000018402\000010',VB1153031859010200,000000000000000000,1



'1450018402\000010',000000000000000000,VB1450018402000010,0

];





t1:

Load

VBELN,

if

(Flag = '1',OBJNR,OBJNR1) as Temp

resident

drop

table t; t;

I am expecting to see only one value VB1153031859010200 in the Temp field.

Advance Thanks for your help.





1 Solution

Accepted Solutions
Not applicable
Author

3 Replies
disqr_rm
Partner - Specialist III
Partner - Specialist III

Not sure why you are expecting only one value in Temp. You have 2 record in table "t" and for those 2 records the correct OBJNR will be loaded in "t1" table due to your IF condition.

If you have to see only one OBJNR, you can put a WHERE condition after "resident t" like:

Load
VBELN,
if (Flag = '1',OBJNR, OBJNR1) as Temp
resident t
WHERE Flag = 1;

Or if you must load both the VBELNs but only one OBJNR where FLag is 1, you can do so by:

Load
VBELN,
if (Flag = '1',OBJNR) as Temp
resident t;

But if I think what you are trying to achieve, having my SAP hat on, I think you would be better off using MAPPING and APPLYMAP, if I guess correctly what you are trying to do.

If nothing of above mentioned works for you, please provide details of what ultimately you are trying to achieve.

Hope this helps.

Not applicable
Author

solved.

disqr_rm
Partner - Specialist III
Partner - Specialist III

Could you pleas validate which method worked for you? Just for my curiosity.