Entity-Condition to compare database fields

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

Entity-Condition to compare database fields

Markus Studer
Hi

I have a problem to create an entity-condition that compares to
fields on the database.

SampleEntity:
Field 1: fromDate
Field 2: minimumFromDate

what I want is to fetch only the fields from the database where
fromDate <
minimumFromDate. Unfortunately, it seems that it is only possible
to
compare against values in entity-condition. What I need is
something
like

                <entity-condition entity-name="SampleEntity" list-
name="samples">
                    <condition-list>
                        <condition-expr field-name="fromDate"
operator="less" to-field="minimumFromDate"/>
                    </condition-list>        
                </entity-condition>

Am I missing the obvious or is it not possible to create such
queries easily in Screens, Minilang etc.

Thank you very much and best regards

Markus Studer

Reply | Threaded
Open this post in threaded view
|

Re: Entity-Condition to compare database fields

BJ Freeman
look at the view-entity.
there are some examples in the entitydef folder of most applications.

[hidden email] sent the following on 11/15/2007 8:11 AM:

> Hi
>
> I have a problem to create an entity-condition that compares to
> fields on the database.
>
> SampleEntity:
> Field 1: fromDate
> Field 2: minimumFromDate
>
> what I want is to fetch only the fields from the database where
> fromDate <
> minimumFromDate. Unfortunately, it seems that it is only possible
> to
> compare against values in entity-condition. What I need is
> something
> like
>
>                 <entity-condition entity-name="SampleEntity" list-
> name="samples">
>                     <condition-list>
>                         <condition-expr field-name="fromDate"
> operator="less" to-field="minimumFromDate"/>
>                     </condition-list>        
>                 </entity-condition>
>
> Am I missing the obvious or is it not possible to create such
> queries easily in Screens, Minilang etc.
>
> Thank you very much and best regards
>
> Markus Studer
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Entity-Condition to compare database fields

jonwimp
In reply to this post by Markus Studer
Now that you mention it, yeah, that doesn't seem possible.

Even with <view-entity>, you cannot have "conditional joiners". Joins in <view-entity> are
restricted to "key-to-key/field" (equality) joins only.

What's <condition-object>, by the way? Anybody knows? I don't see it used?

It shouldn't be difficult to extend <condition-expr> so that it supports what you suggested.

Jonathon

[hidden email] wrote:

> Hi
>
> I have a problem to create an entity-condition that compares to
> fields on the database.
>
> SampleEntity:
> Field 1: fromDate
> Field 2: minimumFromDate
>
> what I want is to fetch only the fields from the database where
> fromDate <
> minimumFromDate. Unfortunately, it seems that it is only possible
> to
> compare against values in entity-condition. What I need is
> something
> like
>
>                 <entity-condition entity-name="SampleEntity" list-
> name="samples">
>                     <condition-list>
>                         <condition-expr field-name="fromDate"
> operator="less" to-field="minimumFromDate"/>
>                     </condition-list>        
>                 </entity-condition>
>
> Am I missing the obvious or is it not possible to create such
> queries easily in Screens, Minilang etc.
>
> Thank you very much and best regards
>
> Markus Studer
>
>