I have a requirement to develop script logic for the following scenario:
Products Prod1, Prod2, Prod3, Prod4 and Prod5 use accounts Acc1, Acc2, Acc3, Acc4 and Acc5 respectively, and have some data in the database. In my script logic, I need to retrieve values for Acc1, Acc2, Acc3, Acc4 & Acc5, and perform the following calculation:
Acc6 = (Acc1 + Acc2 + Acc3 – Acc4 – Acc5)
I need to then send this value (Acc6) to the database, so that end users can use this value to perform further analysis.
With my limited experience in script logic, this is what I could come up with:
*REC(EXPRESSION = (%VALUE%+ GET(PRODUCT="PROD2", ACCOUNT="ACC2") + GET(PRODUCT="PROD3",ACCOUNT="ACC3") – GET(PRODUCT="PROD4", ACCOUNT="ACC4") – GET(PRODUCT="PROD5", ACCOUNT="ACC5"))
The above script logic seems to be working at the moment, but may not be the most efficient code. Could you please provide your expert guidance to improve the code?
Thanks in advance for your help.