I'm having issue applying qlikview built-in function weekday().
On variable setting, i have the following:
In the script, when i use the weekday function i get the correct number but i won't get the correct name when i map to an inline load:
DayNameMap: mapping load * inline [ WeekdayNum, WeekdayName 0, Sun 1, Mon 2, Tue 3, Wed 4, Thu 5, Fri 6, Sat 0, Sun ];
When i change my OS regional setting, it doesn't change the result. I figure that when the weekday is mapped, it is treated as a number. When i use the num function, it will give me a different number. Please see attached file to get what i meant.
Actually Weekday() function returns a weekday value, which is of type Dual. It has it's numeric value and textual representation. When you set SET DayNames='1;2;3;4;5;6;0' you are defining textual representation of the weekdays values. But the result of the numeric counterpart of WeekDay function value does not change. Here is a list of Text, Num pairs, you get as a result of WeekDay function
For Mon (1, 0)
For Tue (2, 1)
For Wed (3, 2)
For Thu (4, 3)
For Fri (5, 4)
For Sat (6, 5)
For Sun (0, 6)
When you call applymap function, actualy it uses numeric counterpart of the value. But as visual representation by default it shows textual representation you defined in WeekNames variable. (Try to change format of Weekday field from Mixed to Numeric and you should see that values representation changes).
To get a numeric value from it's textual representation try to use EVALUATE() function.
We have a field called DayOfWeek that is created using the WeekDay() function. In one of our document files the values are listed as text (Sun, Mon, etc.). In another document using the exact same script to load DayOfWeek Qlikview is showing numeric data (0, 1, etc.). We want text in both documents what would be causing one to show in one format (text) and the other the other format (numeric)?