Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Concatenate String in a variable

Hello,

There is my problem:

i just wanna create a string with all the month name (like"JanuFebrMarcApri...")

How can i do this?

This is what i tried:

for mois=01 to 12

   let TestVar = $(TestVar)&$(=left(MonthName('0000-'&num($(mois), 00)&'-01'),4));

next mois

I get a Syntax Error and I don't know where i'm doing a mistake.

Thanks,

Regards,

Loïc

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Temp:

Load

  RowNo() as NO,

  SubField('$(MonthNames)',';',(Month(YearStart(Today())) + IterNo() - 1)) as MinMonth

AutoGenerate 1

While Month(YearStart(Today())) + IterNo() - 1 <= Month(Today());

Load Concat(MinMonth,',',NO) as AllMonths Resident Temp;

View solution in original post

7 Replies
tresesco
MVP
MVP

Try like(Front end):

=Concat(Distinct(Month(MakeDate(1,mois,1)) )

MK_QSL
MVP
MVP

Load Replace('$(MonthNames)',';','') as Months AutoGenerate 1;

Not applicable
Author

Hello,

The value of my variable TestVar is always <NULL> with:

for mois=01 to 12

   let TestVar = Concat(Distinct(Month(MakeDate(1,mois,1)) ));

next mois

MK_QSL
MVP
MVP

Use my method without any loop or for loop

Not applicable
Author

Thanks but i want to get all the passed months of the current year in the string.

Your way to do this works but i get all the months.

For example, today the string would be 'JanvFévMarsAvrilMaiJuinJuil'

MK_QSL
MVP
MVP

Temp:

Load

  RowNo() as NO,

  SubField('$(MonthNames)',';',(Month(YearStart(Today())) + IterNo() - 1)) as MinMonth

AutoGenerate 1

While Month(YearStart(Today())) + IterNo() - 1 <= Month(Today());

Load Concat(MinMonth,',',NO) as AllMonths Resident Temp;

MarcoWedel

Hi Loïc,



maybe also helpful:


QlikCommunity_Thread_128304_Pic1.JPG.jpg

using this expression:

=PurgeChar(If(Month(Today())<12,Left(MonthNames,Index(MonthNames, ';', Month(Today()))-1),MonthNames),';')


for month names like

QlikCommunity_Thread_128304_Pic2.JPG.jpg


regards


Marco