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: 
aschmeelk
Contributor III
Contributor III

How to change Date format based on Country?

HI all,

I am attempting to change(set) the date format for my App based on the Country Code in our data base using the following code in the data load editor:

If $(vCountry) = 'CA' then

     Set DateFormat = 'D/M/YYYY';

Else

     Set DateFormat = 'M/D/YYYY';

End If;

vCountry is set earlier in my script when the country code is loaded.

I keep getting the following error:

Unexpected token: '=', expected one of: '(', 'ZTestw_z', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'not', 'bitnot', 'LITERAL_NUMBER', ...

---
The error occurred here:
If >>>>>>=<<<<<< 'CA' then
Can anyone point out what I am doing wrong here?

4 Replies
sunny_talwar

May be try this like this...

If '$(vCountry)' = 'CA' then

    Set DateFormat = 'D/M/YYYY';

Else

    Set DateFormat = 'M/D/YYYY';

End If;

Although this might fix the error, I am not sure if this is actually going to work or not... I will be curious to know if it does work in setting different DateFormats based on Country

aschmeelk
Contributor III
Contributor III
Author

No Joy.  Still got the same error. Thanks for the suggestion tho!

sunny_talwar

How is vCountry set? Can you share the script for that

aschmeelk
Contributor III
Contributor III
Author

Sure, here you are:

gra_plant_setup:

let vCountry = peek([Plant Country];

LOAD

PLANT_SETUP_KEY,

    PLANT_CODE,

    PLANT_NAME,

    [Plant Country],

    [Days Till Due]

WHERE EXISTS(PLANT_SETUP_KEY);