Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Partner
Partner

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?

Tags (1)
1 Solution

Accepted Solutions
Partner
Partner

Re: format textfield in script

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'

7 Replies
Not applicable

Re: format textfield in script

Hi Kris,

Can you share you qvw?

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

Thanks

Sabal

Partner
Partner

Re: Re: format textfield in script

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

Re: format textfield in script

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

Partner
Partner

Re: format textfield in script

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'

Partner
Partner

Re: format textfield in script

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

Partner
Partner

Re: format textfield in script

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=??

Partner
Partner

Re: Re: format textfield in script

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