Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
If you could podt your script so that we can see what you are trying to achieve that would be great ...
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
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;