Calculated columns in entity table

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Calculated columns in entity table

Radoslav Tomko
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
Reply | Threaded
Open this post in threaded view
|

Re: Calculated columns in entity table

hans_bakker
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.



Reply | Threaded
Open this post in threaded view
|

Re: Calculated columns in entity table

David E Jones
In reply to this post by Radoslav Tomko

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