Domanda

I've searched for this everywhere but not found anything explaining how so far. I'd like to create calculated fields in like the age of a person, or have a currency field which is a cumulative of several other fields within the same object.

È stato utile?

Soluzione

You have different options to do this:

1) you can create a view and calculate the fields. Within a view you can use group-by and function to calculate min, max, sum, avg, count and others. You can refer to the following link for more informations : http://ofbiz.apache.org/docs/entity.html#View_Entity_Modeling

2) if you are using the domain driven architecture provided by opentaps you can add some code into the repository. The repository works as an abstraction to the data layer allowing you to create calculations and operations before returning the object to the caller

3) You can create a sql with the entity engine and get the calculated fields from the database.

Alberto

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top