Hi Muhammad Ikhwan Afiq bin Azmir
In Mendix you can’t directly use Excel formulas, but you can replicate them with Java Actions or microflows. For your case:Create a custom Java Action that accepts rate, nper and pv as parameters, returns the PMT value, and call it from your microflow.
double pmt1 = -PMT(C16/12, C21, D20);
double pmt2 = -PMT((C16-C10)/12, C21, D20);
double result = pmt1 - pmt2;
Then the java action can be reused,
i hope it helps!!
Hi Muhammed,
You can implement the Excel PMT calculation in Mendix by creating a custom Java Action. Mendix doesn’t provide a PMT function out of the box, so the formula must be handled through Java. Just pass the same inputs you use in Excel (rate/12, number of periods, loan amount, etc.) to the Java Action and return the PMT result to the microflow. Then you can combine multiple PMT calls exactly like in the Excel formula to get the final EMI/Subsidy value.
In Excel the user is using this complex EMI (PMT) formula:
+PMT(C11/12,D20?-C21,(-C17)) + PMT(C16/12,D20?,-C17,(C16/12*D20?)) +
-PMT(C11/12,D21?,-C17 + PMT(C16/12,D21?,-C17,(C16/12*D20?)) )
To convert Excel PMT into Mendix, you need to use a Java Action because Mendix does not have a built-in PMT function.
I once had to perform a similar task, and one way to achieve this is by creating a nanoflow for a JavaScript action, passing your values as strings and using the eval() function with your mathematical expression in a string.
This approach is also dynamic, meaning you can store your formula in an entity and modify it at runtime as needed.