Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

For loop Problem

Hi

PFA

1 Solution

Accepted Solutions
MVP
MVP

Re: For loop Problem

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.

1 Reply
MVP
MVP

Re: For loop Problem

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.

Community Browser