Splitting

Hi All,

I need a logical help in this.
I am working on a usecase in which there are 2 account types official and residential.
For official payment limit is 1500 and residential 1000.
– the payment portal has limitations around the value that can be used for the Payment Amount. If the value exceeds the acceptable amount, the payment amount will need to be split into multiple payments by diving the total by however many payments are necessary to ensure that each payment is within the exceptable value.

so if payment amount for residential is 1200 then its beyond the acceptable hence it will be splitted into 1000 and 200.
can anyone help, how it can be done?
Amount can even be 2500 for residential then BOT will first make payment of 1000 then again comeback and make another 1000 and then 500.
Payment amount will be the input taken from the User

1 Like

Hi @somya177
Suppose You have residential value of 1000 in a Int32 variable use if a condition if the value coming of payment value is greater than 1000 then in the then section you can use following logic in Assign activity.
difference= Payment amount - Residential amount. where all are our Int32 variables.
And the your answer will be Like This.
Residential amount = 1000.
Payment amount= 12000.
Use The If Condition Residential amount >1000 Then In the then section follow the following Logic.
Difference amount= 1200- 1000
so your amount is in two parts now one is residential amount and another one Is difference.
Regards

@somya177
Store the payment amount in a temporary variable and deduct from there one full amount at a time.

Some pseudocode:

tempAmount = amount
while (tempAmount > 1000){
do 1 transaction for 1000
tempAmount = tempAmount - 1000
}
do 1 transaction for tempAmount

For your scenario where amount is 2500 this would loop in the while loop twice, each time doing 1000. Then it would exit the while loop and do 500.

If the amount is less than 1000 initially then it skips the while loop entirely.

You would use a variable instead of 1000 so that it could handle both official and residential.

Can you please share workflow of this…so that I can integrate it quickly

Can you please share workflow of this…so that I can integrate it quickly in my code

Main.xaml (92.4 KB) check this solution and let me know.

hi kalyan,
it worked fine for residential but the requirement is that when i took input from the user about accounty type to be official and gave in_payment amount 2000 then the logic should payment_logic should give 1500 and 500 in the output.But it was null.
So account can be residential or official it has to split the payment keeping exceptable value in consideration.
Residential - 1000
Official-1500
Payment amount can be decimal as well like 1230.23

Hello @somya177 ,
Check this out. This should work for both account types and decimals as well.

SplitNumber.xaml (15.6 KB)

1 Like

thanks @karavinds :slight_smile:

thanks @karavinds
the payment amount got splitted fine…now the thing is that once the amount gets splitted e.g. 1000 ‘residential’ to 600 and 400. then BOT has to do typeinto 600 first into the web application then click submit and post that click on “make another payment” so that bot comes back again to the type into box to type “400” and click submit.
It has to perform these steps till it finishes all the splitted payment amounts otherwise if there is only on etime payment and no splitting required then it will type into 600 and click submit.

Can you please support in providing pseudocode on how it can be done

Hi @somya177,
You can write a separate workflow that takes the split amount as input parameter and handle all your web application activity within the workflow.

Use an if condition to check if the end of the while loop to decide when to stop clicking on “make on another payment” and proceed to next steps.

You replace the message box activity and use invoke workflow to perform web application actions with input as output(counter).

There are several other ways to handle this scenario. Try this and if you stuck making progress, please create a new post to get help on that topic.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.