The following practices are coming from several consultants:
GIT
- must be used by everybody on the project
- if customer is co-operating on the project, they must use it as well
- everybody commits their changes to GIT
- nobody does the changes directly to the partition (without committing to GIT as well)
- the actual version (of the configuration) from GIT can be deployed to the partition at any time
Such approach helps to avoid overrides and solve collisions.
Note: It would be good to have a Role to be able to see the logics in the ReadOnly mode.
Check of the Inputs (from User and Data tables)
...
It is good practice to check whether the data are complete and decide for an appropriate action.
- If configuration data is missing and calculation does not make sense without them, use api.throwException().
- If missing or wrong values are allowed, you can solve it by using alerts (yellow, red, critical) or use api.abortCalculation().
You can create an additional field which shows to the user the alert reasons
.
Code Block language groovy title Sample def priceType = "CostPlus" def price = null def reason = "Unknown error" def targetMargin = api.getElement("TargetMargin") if (targetMargin) { def vat = api.getElement("VAT") def cost = api.getElement("Cost") if (cost && vat != null) { price = cost * targetMargin * (1 + vat) reason = "OK" } else { reason = "No Average or Calculated cost price in PX Cost_RRP or VAT defined" api.redAlert(reason) } } else { reason = "No target margin defined" api.redAlert(reason) } api.local.reason = reason return price