Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Localization lab test, almost there!

Hi everyone, for the past couple of days I have been working, mostly trying to create a function that will allow me to localize some dates, there are a couple of threads that I started regarding some bug QlikView has, if you have some spare time, go ahead and take a look at them:

http://bit.ly/urzrU2

http://bit.ly/vdOz7v

The problem is, the system variables:

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

Can be modified in runtime, but their new value won't be reflected on the expression and date formats that use them like the following:

WWW, MMM D, YYYY = Wed, Nov 24, 2010

So I created a couple of tables DayNames and MonthNames, also a third one called Languages, as you can imagine, the data is linked by Language to each name:

qv4.png

If you find weird the value inside the column MonthName and DayName, that includes both  Locale_<VALUE> its because there is another weird behavior with QV that if I have the same value in a column, the functions FieldValue goes crazy, but that's another story.

I did create a function that returned the date as I wanted, here's the code:

//Day

TextBetween(
    
fieldvalue(
           'DayName'
           ,
FieldIndex(
                'DayID'
                ,
               
Num(weekday($1)) & '_'& GetFieldSelections(Locale) 
           )
     )
     ,'<'
     ,'>'
)
//Delimiter

&', ' &
//MonthName

TextBetween(
     fieldvalue(
           'MonthName'
           ,FieldIndex(
                'MonthID'
                ,Num(Month($1)) & '_'& GetFieldSelections(Locale) 
           )
     )
     ,'<'
     ,'>'
)
//Delimiter&' ' &
//DayNumber

day($1)
//Delimiter

&', ' &
//YearNumber

Year($1)

So far everything was going fine, but when I called it from the calendar:

=$(fn_localizedDate(Date))

It does display the dates as I wanted:

qv5.png qv6.png

But now I am stuck, since after I choose the desired date, the calendar goes blank.

After some testing I see that I selects all the Languages after selecting a date, but why?

Please, any suggestion on how to implement this, or make it to work, as for displaying dates accordingly to the selected language, will be very much appreciated.

Thanks in advance for the time.

-ed

2 Replies
Not applicable
Author

Hello Ed,

I would try another approach. Please take a look (or two) into my example app. Don't hesitate to ask for details, if necessary.

Hint:

Independent of the concept you will use: I recognized that all your tables where singles. In most cases this is not the best approach. Check out the possibilities of linking tables together via uniqe keys. (Or second: the QV-Joins)

HtH

Roland

Not applicable
Author

Thanks for the reply Roland, but I see that you are using pre calculated fields using the load script, since it is about localizing dates, there is a problem of doing that, since depending on the user's time zone, a specific month or day, cannot be pre calculated, since, (GMT +- X) can fall on many days or months, that's why I was trying to use a runtime solution.

Thanks again

-ed