Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

Tags (1)
1 Solution

Accepted Solutions
Not applicable

Re: Using a fieldname that has been created in the loadscript

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

4 Replies
Not applicable

Re: Using a fieldname that has been created in the loadscript

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

Re: Using a fieldname that has been created in the loadscript

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

Not applicable

Using a fieldname that has been created in the loadscript

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
Valued Contributor III

Using a fieldname that has been created in the loadscript

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;