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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kris_vliegen
Partner - Creator III
Partner - Creator III

format textfield in script

Hi all,

in my script I use the set function to set my monthnames

SET MonthNames='jan;feb;mrt;apr;mei;jun;jul;aug;sep;okt;nov;dec';

For translation to the english values I was thinking to do an applymap like this

MonthsEN:

Mapping Load * INLINE [ CalMonth, CalMonthEN

jan, Jan

feb, Feb

mrt, Mar

apr, Apr

mei, May

jun, Jun

jul, Jul

aug, Aug

sep, Sep

okt, Oct

nov, Nov

dec, Dec

];

To

Temp:

load Distinct

  DatumNum as TempDate

resident Detail;

MasterCalendarTemp:

load

  month(TempDate) as CalMonth

resident Temp;

Noconcatenate

MasterCalendar:

load

CalMonth,

  applymap('MonthsEN', CalMonth, 'No Month') as CalMonthEN

 

resident MasterCalendarTemp;

drop table Temp;

drop table MasterCalendarTemp;

This applymap isn't working.

To do a test that both values are the same I created an other table "test"

test:

Load * INLINE [ CalMonth, CalMonthEN1

'jan', Jan

'feb', Feb

'mrt', Mar

'apr', Apr

'mei', May

'jun', Jun

'jul', Jul

'aug', Aug

'sep', Sep

'okt', Oct

'nov', Nov

'dec', Dec

];

This is the result.

CalMonth.PNG.png

How can I format my text so they are all on the left or all on the right?

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

The field CallMonth is loaded as Month(TempDate), the function in the help says int month(Timestamp), although I expect it to be a dual. Your map is based on text values, and fails (no month is the only value), I would try to map to 1-12 instead of 'jan'-'dec'

View solution in original post

7 Replies
Not applicable

Hi Kris,

Can you share you qvw?

I tried at my end with data similar to yours and applymap worked for me.

Thanks

Sabal

kris_vliegen
Partner - Creator III
Partner - Creator III
Author

Here is my qvw.

As you see I have values on the right side of the listbox and values on the left side of the listbox.

How can I put all the values on the same side?

Regards,

Kris

avinashelite

HI Kris,

Go to Presentation >Alignment >make both text and number to left align.

This is because since your mapping its taking it as number

stigchel
Partner - Master
Partner - Master

The field CallMonth is loaded as Month(TempDate), the function in the help says int month(Timestamp), although I expect it to be a dual. Your map is based on text values, and fails (no month is the only value), I would try to map to 1-12 instead of 'jan'-'dec'

kris_vliegen
Partner - Creator III
Partner - Creator III
Author

This is working for me.

But if I Use this in a selectiobox the CalmonthN (this is the field with the month function from Qlikview) is sorting like I would have it.

But the textversions are sorting good (if I sort on the numeric value)

but if I select a value it is automatic set to the last place. How can I let the values in the same order?

calmonth1.PNG.png

Regards,

Kris

stigchel
Partner - Master
Partner - Master

You probably have the sort by state set to descending? If so remove the sort by state check mark. If not I will need more info, sort by expression??, expression=??

kris_vliegen
Partner - Creator III
Partner - Creator III
Author

Hello Piet Hein,

I've tried different sort-settings but nothing seems to work...

You can find my testdashboard in this comment.

If it's possible I would like that the CalMonth and CalMonthEN are sorting the same way as the CalMonthN

Regards,

Kris