Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

aschmeelk
New Contributor II

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

Re: How to change Date format based on Country?

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
New Contributor II

Re: How to change Date format based on Country?

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

Re: How to change Date format based on Country?

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

aschmeelk
New Contributor II

Re: How to change Date format based on Country?

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);

Community Browser