Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10473

Re: Script logic multiplying values wrongly ?

$
0
0

Hi Gersh & Vadim,

 

Thanks for ur replies .

Here only two values will be input-ed by user which is “Value of Asset” and “No of months”

i.e as per formula below  it is A & D will be entered,B&C will be pulled from Database.

 

  Formula ={A-A*(B/100)}/C * (12-D+1)/12

 

Depreciation ={Value of Asset – (Value of Assets*Scrap value %) / (Life Span)} *(No.of.Months till Next march / 12)

A= Value of Asset

B= Scrap value%

C= Life Span

D= No.of.Months till Next march

 

Below is the initial source code for the same,. (Here ASSET_CLASS is an Entity Dimension).

 

*WHEN ASSET_CLASS

*IS *

*REC(EXPRESSION=(([ACCOUNT].[ASSET_VALUE]-([ACCOUNT].[ASSET_VALUE]*([ACCOUNT].[SCRAP_VALUE]/100)))/[ACCOUNT].[LIFE_SPAN])*((12-[ACCOUNT].[PURCHASE_MONTH]+1)/12), ACCOUNT=637700A)

*ENDWHEN

 

As adviced by both of you i also tried to do the same via 2 WHEN\ENDWHEN statements but when i am trying to multiply them(the RED and BLUE code part from above) it is giving double values. plz find the sample code in 2 WHEN statements.

----------------------------------------------------------------------------------

//RED part code is calculated and stored in Account "637700A"

*WHEN ASSET_CLASS

*IS *

*REC(EXPRESSION=(([ACCOUNT].[ASSET_VALUE]-([ACCOUNT].[ASSET_VALUE]*([ACCOUNT].[SCRAP_VALUE]/100)))/[ACCOUNT].[LIFE_SPAN])),ACCOUNT=637700A)

*ENDWHEN

 

//Here the calculated result of RED is multiplied with BLUE code

*WHEN ASSET_CLASS

*IS *

*WHEN ACCOUNT

*IS 637700A

*REC(EXPRESSION=(%VALUE%*((12-[ACCOUNT].[PURCHASE_MONTH]+1)/12),ACCOUNT=637700A)

*ENDWHEN

*ENDWHEN

-----------------------------------------------------------------------------------

 

How should i multiply these values without doubling them because both of them are accounts and the value needs to be posted to an account member.?

Kindly correct me in my WHEN statements,

 

Thanks

Aamer.


Viewing all articles
Browse latest Browse all 10473

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>