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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

If statement in script

Hi there,

i would like to replace some of the values in one of my tables when i load the script with an if statement.

It seems that my syntax is not correct. I want to replace France with FR.

The field i am loading is [CountryregionID]

If it does not find France it should load the rest of values as is.

Best regards,

Lawrence

1 Solution

Accepted Solutions
d_prashanthredd
Creator III
Creator III

Hi Lawrence,

Load

     Fields1, Field 2, ... if( Upper(CountryregionID) = 'FRANCE', 'FR', CountryregionID ) as CountryregionID,

Field N, .... ;

Upper(CountryregionID) comparison will be taken care of france, France, FRANCE

Thanks,

Prashanth Reddy D.

View solution in original post

5 Replies
d_prashanthredd
Creator III
Creator III

Hi Lawrence,

Load

     Fields1, Field 2, ... if( Upper(CountryregionID) = 'FRANCE', 'FR', CountryregionID ) as CountryregionID,

Field N, .... ;

Upper(CountryregionID) comparison will be taken care of france, France, FRANCE

Thanks,

Prashanth Reddy D.

Anonymous
Not applicable
Author

Hi Lawrence,

How do I replace/change values under a column while loading data?

This may helps.

Regards,

Sadasiva

jonathandienst
Partner - Champion III
Partner - Champion III

Or

...

If(CountryregionID Like 'FRANCE', 'FR', CountryregionID) as CountryregionID,

...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Thank you for your replies.

I have a question regarding the country names. In my data the names  are in french and i have a KML file with the ISO2 code. If i need to translate all the country data i will need almost 200 consequent if statements. Is there a fastest way to do this?

Best regards,

Lawrence

d_prashanthredd
Creator III
Creator III

I'm assuming that your country names are of length greater than 2 and ISO

coded are of length 2. In such case, you can write as..

If(Len(Countryname)>2, ISOCode, Countryname)

Slightly you can alter as per your lengths.

On Aug 10, 2017 20:43, "Lawrence Tzigersizoglou" <qcwebmaster@qlikview.com>