Formula for "Net Amount " in a business process

Hi,

I need help to write the formula for "  Net Amount " in a business process.

The business process is as below screenshot.

image.png

When I am trying to use Selection result in Formula popup  I am getting the following error: "Process element "Selection result" not found. "  
 

I need to apply a filter in Commission Rules Selection based on that "Net Amount will be calculated. 

The criteria are as below. "Using the [Distribution_Channel] in the policy register object, query the Commission Rules for that [Distribution_Channel] and cycle through each commission rule. Each rule represents a single Bill. Use the [Commission_Rules.Rate] and [Commission_Rules.Rate_Type] as an input in the formula.

IF [Commission_Rules.Rate_Type] = Percentage

Net Amount = [Base_Premium] x [Commission_Rules.Rate] ELSE

IF [Commission_Rules.Rate_Type] = Flat

Net Amount = [Commission_Rules.Rate] "

Thanks in advance.

Like 0

Like

2 comments

Hi All 
Please give me any idea how to write the formula for the above condition or suggest any other approach.

Dear Jitendra, 

For if statement in a formula you can use conditional operator :
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/conditional-operator
However, unfortunately, you can't loop through records in the formula. To fulfill your business task you would need to use script task, selecting the needed Commission rules records, looping thorough them and creating Bills based on it. 
Here are academy articles that would help you with that: 
For selecting Commission rules with a filter
https://academy.creatio.com/documents/technic-sdk/7-15/introduction-13
https://academy.creatio.com/documents/technic-sdk/7-15/retrieving-information-database-select-class
For adding new Bill
https://academy.creatio.com/documents/technic-sdk/7-15/working-database-entity-entity-class

Show all comments