Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm trying to do a preceding load, and it will change the original value to something else.
For example, i have a column of zone in a table, which i need to rename the zone, from AP > Asia, EU > Europe.
I know in vb we normally do CASE, or even IF-ELSE. but is there IF-ELSE in Qlikview?
i did a nested IF-ELSE like this...
if(Geographical_zone='AF', RefzoneCode='EUROPE', (IF(Geographical_zone='AS-PA', RefzoneCode='ASIE', (if(Geographical_zone='NA', RefzoneCode='AMERIQ', (if(Geographical_zone='LA', RefzoneCode='AMERSU', (if(Geographical_zone='ME', RefzoneCode='EUROPE', ( if(Geographical_zone='EU', RefzoneCode='EUROPE') ) ) ) ) ) )))))as RefzoneCode,
doesn't really work. If you have better idea, please share with me?
Thanks.
With QlikView, I try to avoid using these classical if-else statements. Instead, try using the incredible associative power built-in to QlikView.
For example, try adding the following line of code to your script:
LOAD * INLINE [
Geographical_zone, RefzoneCode
AF, EUROPE
AS-PA, ASIE
NA, AMERIQ
LA, AMERSU
ME, EUROPE
EU, EUROPE
];
Once you reload your script with the code above, every record that has a matching Geographical_zone value will now be associated with a corresponding RefzoneCode. No functions or special coding required.
I hope this helps ensure your success.
Best regards,
James
Hi James,
Thanks for your suggestion, ideally, that's the better solution. But due to my db structure in QV, i can't do it that way.
I need this zone to intact with the original table. after that, i'll use the value of this field to create key like (year & - & Zone) as PriKey.
but, or there's a way to do the same with your ideal? i haven't figured it out yet.
By the way, the nested if statement is working by removing the column name in the [then] condition.