I have define a field of type code in a doctype.
In the document i have defined a formula.
I want to evaluate the formula to obtain the result using server script.
Any Idea.
I have define a field of type code in a doctype.
In the document i have defined a formula.
I want to evaluate the formula to obtain the result using server script.
Any Idea.
You would need to use eval, but it is disabled for server scripts for security concerns
Instead, you could use eval on a client script, which is allowed
Also try virtual docfields: Virtual DocField
Currently managing with client script. We are building a dynamic conditions that can be applied to any doctype field. We are thinking of making it as API so that this can be used by any doctype. Unfortunately via client script, it restricts the formula to that particular doctype
Can you further explain your use case? Just curious.
Building a conditions like SAP. I need a field to be calculated by a sequence of formulas and conditions. something similar to payroll calculation in Frappe HRMS app.
Once the dynamic calculation procedure is ready you can attach it to a doctype field. this way we need not modify the code every time for field to be computed.
Seems like something you should do on a custom app, although I haven’t tried building one yet.
For calculating complex data in a doc, I’m currently just firing webhooks to another NodeJS server, making the calculations there and then updating the doc with the REST API