You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Radoslav Tomko <zh...@zvolen.biz> on 2007/08/23 08:03:31 UTC

Calculated columns in entity table

Hello,

Is there a way to create calculated columns in entity tables ?
For example, I have date column, and I want 3 more "calculated" columns, 
that will hold day, month and year separately.
(for special fast searching and so ... )
Some sql servers has that feature built-in.
Or is there another way to do this (put some code somewhere for 
additional update after insert, or create trigger) ?

Thanx in advance.

Radoslav Tomko

Re: Calculated columns in entity table

Posted by David E Jones <jo...@hotwaxmedia.com>.
Do you mean columns that are derived from other things in the database? In OFBiz we use something like a database trigger, but it happens in the app server and it's called an Entity Event-Condition-Action rule (EECA rule). These are specifically for maintaining derived data, as opposed to Service ECA (SECA) rules which are for managing high level processes, especially as they just across major functional areas.

See the Entity Engine Guide and Service Engine Guide for more details.

For an example look into the InventoryItem.quantityOnHandTotal field.

-David


Radoslav Tomko wrote:
> Hello,
> 
> Is there a way to create calculated columns in entity tables ?
> For example, I have date column, and I want 3 more "calculated" columns, 
> that will hold day, month and year separately.
> (for special fast searching and so ... )
> Some sql servers has that feature built-in.
> Or is there another way to do this (put some code somewhere for 
> additional update after insert, or create trigger) ?
> 
> Thanx in advance.
> 
> Radoslav Tomko

Re: Calculated columns in entity table

Posted by Hans Bakker <ma...@antwebsystems.com>.
You can use 'row-actions' and include there bsh scripts to calculate
these values. Search the xml files of OFBiz for examples.

hope this helps,

Regards,
Hans

On Thu, 2007-08-23 at 08:03 +0200, Radoslav Tomko wrote:
> Hello,
> 
> Is there a way to create calculated columns in entity tables ?
> For example, I have date column, and I want 3 more "calculated" columns, 
> that will hold day, month and year separately.
> (for special fast searching and so ... )
> Some sql servers has that feature built-in.
> Or is there another way to do this (put some code somewhere for 
> additional update after insert, or create trigger) ?
> 
> Thanx in advance.
> 
> Radoslav Tomko
> 
-- 
http://Antwebsystems.com : OFBiz Quality support for competitive rates.