Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Load Script - Using Variables

Hi All

Is there a way of using variables and interacting with the fields inside a load script without each statement having to load a value.

The script needs to analyse a field [coverage area] that is already resident from a previous load statement and based on finding a substring ':' decide how to load it.

I have 2 examples below.

The first example doesn't work but is more logical to me

set vPosition = 1;

set vSubString = 'substring';

CoverageAreaTopLevel:

load [ID] as [ID],

$(vposition) = index([coverage area], ':', 1),

if($(vposition)<>1,left([coverage area], $(vposition))) as [Coverage Group],

resident timeentries;

The second example works, but I find there is a limit to the amount of nested logic that can be contained within one statement

CoverageAreaTopLevel:

load [ID] as [ID],

if(index([coverage area], ':', 1)<>0,left([coverage area],index([coverage area], ':', 1))) as [Coverage Group]

resident timeentries;

Any pointers would be much appreciated.

Thanks

JP

Tags (3)
2 Replies
MVP & Luminary
MVP & Luminary

Load Script - Using Variables

Hi,

Try using the SubField() in the load script

CoverageAreaTopLevel:

load [ID] as [ID],

if(index([coverage area], ':', 1)<>0,SubField([coverage area], ':',1) ) as [Coverage Group]

resident timeentries;

Hope this helps you.

Regards,

Jagan.

Not applicable

Re: Load Script - Using Variables

Hi Jagan

Thanks for the help.

It's not quite what I was after, I was more looking for a more reading friendly way of laying out the code, so it's easier to understand the logic.

More of.

If

Xxxx

Else

Xxxx

End

I'm not sure if this can be done in a load script?

Thanks

Jp

Sent from my iPad