Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

simple multiplication in script doesnt work????? need help please??

Hi,Please can you help me with the below issue please??????????

I want to multiply 2 fields and get the result into the 3rd field.

Nominal_Quantity*value as new_value

the above expression yeilds the correct result if I put it in a chart as an expression but if I use it in the script it doesnt work.Can someone please help.

9 Replies
tresesco
MVP
MVP

Are these fields coming from one table? If so, try putting them withing RangeSum() like,

Load

          RangeSum(Nominal_Quantity*value as new_value) as NewField

Not applicable
Author

Hi Sahana,

In script try to convert null values with zero,

Try following script line

if( isnull(Nominal_Quantity)=-1,0,Nominal_Quantity) * if(isnull(Value)=-1,0,Value ) as New_Value


-Rajendra

MayilVahanan

Hi

Try with this also, if both the fields are from same table

Alt(Nominal_Quantity, 0) * Alt(Value, 0) as New_Value;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

I am pulling the 2 fields from a resident table.will this work??

MayilVahanan

Hi

That will work.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi all,

I tried all these but somehow it doesn't work.... I have attached my file for your ref... please can u help me out?????

here in the sheet 6 a table is present where I am comparing my script calculated value (newfield)with the direct value in the chart(oldfield).

in the script refer to the 2nd tab almost at the end.

MayilVahanan

HI

Try like this

load

market_value_1,

RangeSum(Nominal_Quantity*value) as NewField

resident data_

group by market_value_1;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

but my market_value_1 does not come from date_ :,it comes from MarketValues:

tresesco
MVP
MVP

As I mentioned in the very first post, you can't use two fields from two tables in a load statement. They have to be from the same table. To do so, you need to join them or think of Applymap option. Otherwise, associate the tables properly in the script and get the values calculated in the front-end.