Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

For loop Problem

Hi

PFA

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Please find script below

FOR i = 1 to Month(Today()) -1

  LET vMonthYear = Text(Date(MakeDate(Year(Today()), i), 'MMM YYYY'));

  If i = 1 then

  Data:

  LOAD organizationLookupDesc,

      corporateFunctionLookupDesc,

      employeeRootId,

      lastName,

      firstName,

      '$(vMonthYear)' AS SheetName    

  FROM

  [EMEA HEADCOUNT 2014_GMBH-Anonym.xlsx]

  (ooxml, embedded labels, table is '$(vMonthYear)');

  ELSE

  Concatenate(Data)

  LOAD organizationLookupDesc,

      corporateFunctionLookupDesc,

      employeeRootId,

      lastName,

      firstName,

      '$(vMonthYear)' AS SheetName      

  FROM

  [EMEA HEADCOUNT 2014_GMBH-Anonym.xlsx]

  (ooxml, embedded labels, table is '$(vMonthYear)');

  ENDIF

NEXT

Regards,

Jagan.

View solution in original post

1 Reply
jagan
Luminary Alumni
Luminary Alumni

Hi,

Please find script below

FOR i = 1 to Month(Today()) -1

  LET vMonthYear = Text(Date(MakeDate(Year(Today()), i), 'MMM YYYY'));

  If i = 1 then

  Data:

  LOAD organizationLookupDesc,

      corporateFunctionLookupDesc,

      employeeRootId,

      lastName,

      firstName,

      '$(vMonthYear)' AS SheetName    

  FROM

  [EMEA HEADCOUNT 2014_GMBH-Anonym.xlsx]

  (ooxml, embedded labels, table is '$(vMonthYear)');

  ELSE

  Concatenate(Data)

  LOAD organizationLookupDesc,

      corporateFunctionLookupDesc,

      employeeRootId,

      lastName,

      firstName,

      '$(vMonthYear)' AS SheetName      

  FROM

  [EMEA HEADCOUNT 2014_GMBH-Anonym.xlsx]

  (ooxml, embedded labels, table is '$(vMonthYear)');

  ENDIF

NEXT

Regards,

Jagan.