on 05-07-2014 5:48 PM
Hi SDN'ers,
I'm currently working through a Profit Share calculation in Script Logic.
To simplify the requirement, we need the following behaviour:
1. If Net Profit is Positive (+0) then multiply by a Profit Share driver
2. If Net Profit is Negative, do nothing (do not multiply by the Profit Share driver)
It is my understanding that Script Logic will not use Signed Data in a *WHEN statement, so cannot say:
*XDIM_MEMBERSET AUDIT_ID = INPUT
*XDIM_MEMBERSET ACCOUNT = BAS(NET_PROFIT)
*WHEN ACCOUNT
*IS NET_PROFIT
*WHEN SIGNEDDATA
*IS > 0
*REC(FACTOR = 1, AUDIT_ID = PROFIT_SHARE) // Write value to Profit Share Audit ID
*ENDWHEN
*ENDWHEN
Another option performing this task is obviously creating a BAdI that will handle this scenario, however it seems to be massively over-kill and harder for the business to support than script logic.
Sharing of any experience and/or confirmation that conditional logic on signed data values would be appreciated.
Nick
Hi Nick,
Ternary operator is supported in script logic:
(a>b) ? c : d (if true then c, false - d)
*XDIM_MEMBERSET AUDIT_ID = INPUT
*XDIM_MEMBERSET ACCOUNT = BAS(NET_PROFIT)
*WHEN ACCOUNT
*IS *
*REC(EXPRESSION= (%VALUE%>0) ? %VALUE%*[ACCOUNT].[PROF_SHARE_DRIVER] : %VALUE%, AUDIT_ID = PROFIT_SHARE)
*ENDWHEN
Vadim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nick,
You should try something like this
*XDIM_MEMBERSET AUDIT_ID = INPUT
*XDIM_MEMBERSET ACCOUNT = BAS(NET_PROFIT)
*WHEN ACCOUNT
*IS *
*REC(EXPRESSION= ((%VALUE%>0)*1), AUDIT_ID = PROFIT_SHARE) // Write value to Profit Share Audit ID
*ENDWHEN
Please also check out page 25 in this document
Good luck!
Akos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
16 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.