Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I had a problem in multiplying a field value by -1 at script level, look at my script, it's not working.
Example:
My data in backend is like this:
ID Amount
1 -800
2 700
3 -900
4 1000
5 -400
Whenever I am fetching data from backend and storing it into qvd,
In QVD, Amount should multiply by -1
My script is:
Table1:
Load
ID,
(Amount*(-1)) as Amount
From SchemaName.TableName;
Store Table1 into [../Data/Qvd/Table1.Qvd](qvd);
In QVD, Data should be like this:
ID Amount
1 800
2 -700
3 900
4 -1000
5 400
Your feedback is precious to me. . .
Brijesh
Hi er.mohit,
if(Amount>0,Amount*-1, Amount*-1) as Amount <--- it will make positive to negative and negative to positive. . . I have tried this, but why I can't do in this way--> Load ID, -1*Amount as Amount from........??
Thanks
Change the name of your newly created Amount field name:
Like:
Load
Amount*(-1) as NewAmount
Hi Brijesh,
Your script should work. Can you post error load msg and full script here?
Regards,
Sokkorn
Thanks Sokkorn Cheav (Cambodia) for your efforts. . .
There is no error, just I am getting the same data as it was without multiplying by -1 even though we are applying the operator there. . .
Hi Brijesh,
Let try this one
Table1:
Load
ID,
Num(Amount)*-1 as Amount
From SchemaName.TableName;
Let me know the result.
Regards,
Sokkorn
Thanks for your time, tresesco ...
it's working while we are using this in INLINE, but when we are fetching data from backend i.e we are using it with select or load statement, it's not working. . .
Can you share your sample application?
have you tried this
if(Amount>0,Amount*-1) as Amount
Hi er.mohit,
if(Amount>0,Amount*-1, Amount*-1) as Amount <--- it will make positive to negative and negative to positive. . . I have tried this, but why I can't do in this way--> Load ID, -1*Amount as Amount from........??
Thanks
Brijesh,
PFA. it works even with LOAD. may be there is something wrong in your app. if you can share,,,,,,can be checked.