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

How to make 4 part of my script into 1 ? for easy maintenance

Hi All

My diamension 1 to 4 have 30 items for user selection.

I have to duplicate my script 4 times. and when i change i need to change at 4 part. it there a sample approach ? ( Notice that the only different is 1 2 3 4.

Sample of my code as below :-

WhatIfDimension:

LOAD * INLINE [

    Pls select 1st Dim,Column1

  Desc,GL_DESC

  Code,GL_CODE

  company,company

  ];

WhatIfDimension:

LOAD * INLINE [

    Pls select 2st Dim,Column2

  Desc,GL_DESC

  Code,GL_CODE

  company,company

  ];

WhatIfDimension:

LOAD * INLINE [

    Pls select 3st Dim,Column3

  Desc,GL_DESC

  Code,GL_CODE

  company,company

  ];

WhatIfDimension:

LOAD * INLINE [

    Pls select 4st Dim,Column4

  Desc,GL_DESC

  Code,GL_CODE

  company,company

  ];

1 Solution

Accepted Solutions
Sokkorn
Master
Master

Hi Paul,

You may try script below to reduce repeat typing in load script:

For Each i in 1,2,3,4

WhatIfDimension$(i):

LOAD * INLINE [

  Pls select $(i)st Dim,Column$(i)

  Desc,GL_DESC

  Code,GL_CODE

  company,company

  ];

NEXT i;

By the way, you may thinking about Alternative State function also.

Regards,

Sokkorn

View solution in original post

4 Replies
Sokkorn
Master
Master

Hi Paul,

You may try script below to reduce repeat typing in load script:

For Each i in 1,2,3,4

WhatIfDimension$(i):

LOAD * INLINE [

  Pls select $(i)st Dim,Column$(i)

  Desc,GL_DESC

  Code,GL_CODE

  company,company

  ];

NEXT i;

By the way, you may thinking about Alternative State function also.

Regards,

Sokkorn

Not applicable
Author

Concatenate those 4 tables , it will be definetely provide a solution...

Not applicable
Author

Hi Sok

Thank you , it work.

The tiger is vey far away from you ?

Paul

Sokkorn
Master
Master

Mr. Paul,

It around 0.5m away from me . You can find it in Changi Airport.

Regards,

Sokkorn