Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using a fieldname that has been created in the loadscript

Hi All

I have a simple script that loads some data from a resident table

Instructions:

load

     [ID] as [ID],

     [Name] as [Name],

     [Cost] * [Markup] * [VAT] as [Total Price]

    

Resident DataLoad;

Inside the script I want to interact with the [Total Price] field to determine some other calculations i.e.

If ([Total Price] > 5000, 'Large Order', 'Small Order') as [Order Size]

But since the [Total Price] field is being created in the script I can't access it, when I reference it as in the example above I get an error that [Total Price] can't be found

In this example I could do something like:

If ([Cost] * [Markup] * [VAT] > 5000, 'Large Order', 'Small Order') as [Order Size]

but that seems redundant and in the scenarios I have the situation is considerably more complex than the example above

Any help much appreciated.

Thanks

JP

1 Solution

Accepted Solutions
Not applicable
Author

I may understand this wrongly but do you mean you get the erro message when you are applying the next load statement???

eg

Left Join (Instructions)

Load

ID,

If ([Total Price] > 5000, 'Large Order', 'Small Order') as [Order Size]

resident Instructions;

because this should work...

Ali

View solution in original post

4 Replies
Not applicable
Author

I may understand this wrongly but do you mean you get the erro message when you are applying the next load statement???

eg

Left Join (Instructions)

Load

ID,

If ([Total Price] > 5000, 'Large Order', 'Small Order') as [Order Size]

resident Instructions;

because this should work...

Ali

Not applicable
Author

If you could podt your script so that we can see what you are trying to achieve that would be great ...

Not applicable
Author

Hi Ali

That works perfectly. I was trying to access the field in the original load statement rather than running a join like you suggested.

Cheers

JP

mdmukramali
Specialist III
Specialist III

Dear,

jp.

The filed [Total Price]  which you created In the instructions Table is created once the table is loaded

before loading the table if you perform any opertion on [Total Price] that one will give error.

so you need to add another table.

Like,

TotalPriceTable:

load * inline

[

[ID] as [ID],

If ([Total Price] > 5000, 'Large Order', 'Small Order') as [Order Size]

Resident Instructions;