Calculation in Application Studio

Hello,
I have created a UD field in ECORev and two UD fields in ECOMtl.
now, I want to do the following calculation
ECOMtl.UD2 = ECORev.UD1 * ECOMtl.UD1.
I checked the dataview. when ECORevUD1 is changed, ECOMtl not populated. when ECOMtl.UD1 is modified, ECORev is not populated.
I don’t know how to update all ECOMtl.UD2 when ECORev.UD1 got modified in application studio.

I checked the DataRule. it is only working on one dataview.
my formula is based two different dataview.

any ideas?

thanks,

Eddy

Hello,
I found it is impossible to add formula in application studio if source are from two different dataview even it is a simple formula.
finally I found a way to do it in BPM.

regards,

Eddy

Hello,

How did you do this with a BPM? Can you share some additional details?

Thanks!

Looks like you found a solution but you could also do it without a BPM by calling an erp-function tool inside of an event (like a button onclicked event). In function maintenance, make a custom code function with 2 input parameters and 1 return value for your result. Inside the custom code editor, write your formula and then set the return value equal to the resultant of this formula.

To set a dataview equal to your return value from the function, make the OnSuccess event of the erp-function point to a row-update tool. In row-update, go to Parameters then Columns and then set the Ep Binding to your dataview and the value to “{actionResult.NAMEOFYOURRETURNVALUE}”.

There might be an easier way to do it but that’s how I do it.

image

you cannot put business logic into the UI itself. BUT you can do it as described above with a function. An action (such as changing a value) can be associated to a FUNCTION that would be called to do the work.
OR you can create a BPM that is triggered on an event, either before or after the event happens.

Going to accidentally summon Kevin L with these definitive “you can’t” statements.

1 Like

OK… maybe I should have said “you should not”… of course, if you have something that calls logic while in the UI, you are actually putting logic into the UI… but that said, the work SHOULD be done with Functions instead of in the UI.
Example, we had people putting logic into the old smart client sales order entry system to calculate commissions… the problem with that is you had to actually be in the application to get the calculation to run. If the order was created by any other method (Import from Website, Quote, epicor commerce, or other mechnism) the commissions didnt calc until a person ran the app, loaded the order, and did something to cause the UI to run the commission calc.
By putting the business logic into a function, it can be triggered from outside as well, no matter what way the order is entered.

2 Likes

This is great advice and well put. I appreciate the informative reply to my bad joke :grimacing:

I ran into this same issue with my product configurators a while back. Certain inputs in the Configurator would change the OrderQty, but also certain UD fields we use in a custom report. If a user changed the quantity directly in the Sales Order Entry, without making the configurator changes, the SSRS Report with the specifications wouldn’t match the quantity.

No worries… no harm no foul (or was it a fowl)
image

2 Likes

Hello,
in the bpm, in the pre-processing, add the execute code and then you can write c# then.

regards,

Eddy

I know this was solved, but the fact that it uses a function seems like overkill to me. You can do this without a function, by using the calculation Widget and updating the other UD field.
image
image
image
This calculation widget takes a Number and multiples it by -1.

3 Likes