On a recent project I worked on, I came up with a few reusable pieces of Workflow logic that I built into User Defined Actions.  The original task was to design workflows whose important components were build around bank interest rates, savings and loans.

Savings

Giving a starting amount, an annual interest rate and a specified number of years, what is our expected earnings if we put this amount into a saving account?

The Compound interest formula used for savings looks like this:

M = P( 1 + i )n

M : Total Amount you have after the time persion including your starting principal amount.

P : Principal amount of money you are starting with

i : Annual Interest rate

n : The number of years you will be investing this money for.

If I wanted to just use this once, I would build it into the workflow itself.  But since this could have other uses and could be used in other workflows, putting this logic into a User Defined Action seemed the logical thing to do.

I didn't comment the UDA that much since there are only a few actions in it. The only interesting part about it, is that because I had a need to perform a Power operation, since it's not part of the Math Calculation action, I used the fn-Power inline function.  The result is stored in a Text Variable and then I use a Convert Value action to convert it back to a number.

This inline function takes 3 input parameters and 1 output parameter. The resulting workflow that uses this UDA looks like this : You can download all the necessary files at the bottom of this post.

Loan

Given a starting loan amount, a fixed interest rate and the number of years for the loan, what is the amount we have to pay per month and how much of that is the interest amount each month?

From this, we can determine how much interest we will eventually pay.

Ammortization formula looks like this : I put the above formula in it's own UDA.  It takes 3 input parameters and 1 output and the output is the amount you have to pay for this loan each month.

One other thing that we needed, was the ability to figure out how much interest we are paying each month and how much off the principal.  So I created another UDA to calculate the Interest based on the principal.

The Repayment per Month UDA looksl likes this: The Interest Amount UDA looks like this : Finally, we come to the workflow.  I decided to build the workflow that would take the values from a list item, then show me each payment per month and how much of it was the Interest component. Conclusion

Hopefully these UDAs will help some people, whether in business or in their own personal finances.

It just goes to show, that you can do some interesting things with Nintex Workflow.  The hard part, is figuring out the logic to get you from A to B.

Posted by Vadim Tabakman Sunday, September 30, 2012 8:10:00 PM Categories: