Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Load Script

Hi All

I need some help with load scripts:

I have a standard load script loading some data from excel sheet which is fine, i have a rather complicated if structure to calculate a value, lets call it 'Calculated Value A' which i save to the table structure, this all works great.

However in the same load script i want to access 'Calculated Value A' which I have just created and use it in further calculations, rather than just repeating the whole complicated if structure again is there a way to gain access to the value in the field that has just been created? 

Load

     line 1

     line 2

     if (  if ( if ( etc ))) as [Calculated Value A]

     if [Calculated Value A] = 'Yes' then do something

From

     etc etc

Thanks

JP

Tags (2)
1 Solution

Accepted Solutions
Employee
Employee

Re: Load Script

No, its correct.

When using pre load all happens bottom to up

Load // this happens affer load below

    *,

     if [Calculated Value A] = 'Yes' then do something;

Load // this happens first

     line 1

     line 2

     if (  if ( if ( etc ))) as [Calculated Value A]

From

     etc etc

9 Replies
Employee
Employee

Re: Load Script

Use a 'pre-load'

Load

    *,

     if [Calculated Value A] = 'Yes' then do something;

Load

     line 1

     line 2

     if (  if ( if ( etc ))) as [Calculated Value A]

From

     etc etc

Not applicable

Re: Load Script

Hi JP

I think you can use the same calculation again but with an extra if statment:

Load

     Line1,

     Line2,

     IF( IF ( IF (ETC))) as [Calculated Value A],

     IF( IF( IF ( IF (ETC))) = 'Yes', something, somethingelse) as Somethingnew

From

Etc Etc

I hope this helps.

Michel

Not applicable

Re: Load Script

Thanks Michel thats the solution I had but i thought it was rather messy and there had to be a better way.

Not applicable

Re: Load Script

Hi Anjos

This looks sensible thanks, is the syntax as you have it with the 2 loads? if the script loads top to bottom should you not have it like this:

Load

     line 1

     line 2

     if (  if ( if ( etc ))) as [Calculated Value A]

Load

    *,

     if [Calculated Value A] = 'Yes' then do something;

From

     etc etc

Not applicable

Re: Load Script

I've not used the pre-load option but you could also do it in 2 tables if you wanted to keep it neater.  So you use your first table as a temp table and then calculated off this.

Employee
Employee

Re: Load Script

No, its correct.

When using pre load all happens bottom to up

Load // this happens affer load below

    *,

     if [Calculated Value A] = 'Yes' then do something;

Load // this happens first

     line 1

     line 2

     if (  if ( if ( etc ))) as [Calculated Value A]

From

     etc etc

Not applicable

Re: Load Script

Perfect just tried it and it works a treat.

Thanks a mil for your help.

Cheers

JP

Employee
Employee

Re: Load Script

JP,

Would you mind marking this discussion as answered?

Not applicable

Re: Load Script

I was looking for that yesterday but I can't find it in the new layout ??

Sent from my iPhone

Community Browser