Hopefully I explain this correctly. On the Project Revenue Budget tab I’ve added two new fields: Unit Cost and Mark Up. When the values in these fields change we want to update the Unit Rate. I’m using the FieldUpdated event to do this and everything works great. The problem is that we also want to allow the user to enter the Unit Rate manually and when that happens it needs to update the Mark Up. This also works fine but the issue is that when the Mark Up is updated from the change in Unit Rate the FieldUpdating event on the Mark Up is called and then updates the Unit Rate again. Currently my Mark Up rounds to two decimal places. Because of the rounding on the Mark Up the Unit Rate is then recalculated incorrectly.
1 - Can I change my precision on the Mark Up to more than two decimal places to give me more precision and prevent rounding? If so, the how?
2 - Can I prevent the code from running in the FieldUpdated event for Mark Up when the Unit Rate is changed?
3- Should I be using a different event for this?
Best answer by ddunn
When you use:
e.Cache.SetValueExt<PMBudgetExt.usrMarkUp>(row, markUp.Value * 100);
You’re invoking the business logic. If you want to update a field without invoking the logic then update the field like:
c.MyFieldToUpdate = NewFieldValue;
Then you can update the cache:
theGraph.Transactions.Update(row); or theGraph.Document.Update(row);
I think that will get you what you want.