View filtering

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

View filtering

opablo
Hi all,

Since I began working with OfBiz I missed a feature in its entity
engine: some feature to allow to include some sort of filtering in the
view definition. I'm talking about a code like the following (the
"filter" tag):

<view-entity entity-name="Suppliers"
        package-name="the.package.name"
        title="List of suppliers">
        <member-entity entity-alias="PR" entity-name="Party_Role"/>

        <alias-all entity-alias="PR"/>

        <view-link entity-alias="PR" rel-entity-alias="P">
            <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
        </view-link>

        <filter entity-alias="PR">
            <key-map field-name="roleTypeId" value="SUPPLIER">
            </key-map>
        </filter>
    </view-entity>    

I know I can do the filtering when obtaining the data by code just by
adding the filter condition, but when views grow, it is easier to
organize your views into "functional" areas, or even it helps when
querying and browsing data in webtools tab.

Is it in the roadmap for next versions? Has anyone discussed about this
previously?

Thanxs,

Oscar

Reply | Threaded
Open this post in threaded view
|

Re: View filtering

jonwimp
Hi Oscar,

I started a thread on it quite recently. See
http://www.nabble.com/forum/ViewPost.jtp?post=12018323&framed=y .

I don't see any possibility in the current Entity Engine to do what we want.

I have my own implementation to do this, since there wasn't any interest from OFBiz ML to get this
functionality into OFBiz SVN.

In fact, I seem to have been compiling quite a sizable pile of enhancements I haven't been able to
put back into OFBiz SVN! There are other enhancements, in the Widget department, the Entity
Engine, the Minilang, etc.

If you can help me document this "feature request" in the JIRA issues, help iron out the details
and community requirements and thoughts on this, I'll put in my enhancement right there.

Jonathon

opablo wrote:

> Hi all,
>
> Since I began working with OfBiz I missed a feature in its entity
> engine: some feature to allow to include some sort of filtering in the
> view definition. I'm talking about a code like the following (the
> "filter" tag):
>
> <view-entity entity-name="Suppliers"
> package-name="the.package.name"
>         title="List of suppliers">
>         <member-entity entity-alias="PR" entity-name="Party_Role"/>
>
>         <alias-all entity-alias="PR"/>
>
>         <view-link entity-alias="PR" rel-entity-alias="P">
>             <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
>         </view-link>
>
>         <filter entity-alias="PR">
>             <key-map field-name="roleTypeId" value="SUPPLIER">
>    </key-map>
>         </filter>
>     </view-entity>    
>
> I know I can do the filtering when obtaining the data by code just by
> adding the filter condition, but when views grow, it is easier to
> organize your views into "functional" areas, or even it helps when
> querying and browsing data in webtools tab.
>
> Is it in the roadmap for next versions? Has anyone discussed about this
> previously?
>
> Thanxs,
>
> Oscar
>
>

Reply | Threaded
Open this post in threaded view
|

Re: View filtering

opablo
Hi Jonathon,

I've been reading the thread you posted, and I think you've got a point
presenting the example: it is one classic situation where filtering is
needed (or at least avoids many headaches!).

I also read David's post:

>In general entity and view entity definitions are meant to model
>structure, not query constraints. Just add your desired constraints to
>the EntityCondition passed into the findByCondition call (or Map for
>findByAnd or whatever).
>
>-David

and I only want to add that views don't model structure, they model only
a view of the data (filtered and not filtered). Tables (entities) are
what model the structure.

The "expert" in this "modelling" are database systems, and they do have
this kind of filtering in their views (as SQL prompts in its standard).

Just tell me what can we do to add this "feature request" to JIRA and
I'll work on it. And then we could try to convince David to accept the
feature in OfBiz! :P

Oscar

On Mon, 2007-09-10 at 18:50 +0800, Jonathon -- Improov wrote:

> Hi Oscar,
>
> I started a thread on it quite recently. See
> http://www.nabble.com/forum/ViewPost.jtp?post=12018323&framed=y .
>
> I don't see any possibility in the current Entity Engine to do what we want.
>
> I have my own implementation to do this, since there wasn't any interest from OFBiz ML to get this
> functionality into OFBiz SVN.
>
> In fact, I seem to have been compiling quite a sizable pile of enhancements I haven't been able to
> put back into OFBiz SVN! There are other enhancements, in the Widget department, the Entity
> Engine, the Minilang, etc.
>
> If you can help me document this "feature request" in the JIRA issues, help iron out the details
> and community requirements and thoughts on this, I'll put in my enhancement right there.
>
> Jonathon
>
> opablo wrote:
> > Hi all,
> >
> > Since I began working with OfBiz I missed a feature in its entity
> > engine: some feature to allow to include some sort of filtering in the
> > view definition. I'm talking about a code like the following (the
> > "filter" tag):
> >
> > <view-entity entity-name="Suppliers"
> > package-name="the.package.name"
> >         title="List of suppliers">
> >         <member-entity entity-alias="PR" entity-name="Party_Role"/>
> >
> >         <alias-all entity-alias="PR"/>
> >
> >         <view-link entity-alias="PR" rel-entity-alias="P">
> >             <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
> >         </view-link>
> >
> >         <filter entity-alias="PR">
> >             <key-map field-name="roleTypeId" value="SUPPLIER">
> >    </key-map>
> >         </filter>
> >     </view-entity>    
> >
> > I know I can do the filtering when obtaining the data by code just by
> > adding the filter condition, but when views grow, it is easier to
> > organize your views into "functional" areas, or even it helps when
> > querying and browsing data in webtools tab.
> >
> > Is it in the roadmap for next versions? Has anyone discussed about this
> > previously?
> >
> > Thanxs,
> >
> > Oscar
> >
> >

Reply | Threaded
Open this post in threaded view
|

Re: View filtering

jonwimp
Hi Oscar,

 > I also read David's post:
 >
 >> In general entity and view entity definitions are meant to model
 >> structure, not query constraints. Just add your desired constraints to
 >> the EntityCondition passed into the findByCondition call (or Map for
 >> findByAnd or whatever).
 >>
 >> -David
 >
 > and I only want to add that views don't model structure, they model only
 > a view of the data (filtered and not filtered). Tables (entities) are
 > what model the structure.

I had neglected to add that your "View filtering" thread had put forth the issue more eloquently
than I had in my own thread. :) Yes, views don't model structure but model views instead. And
views are inherently conditional, like "Put your eye squarely on the smaller end of the telescope,
and point the telescope in a SPECIFIC direction, and you'll see what I wanted you to see". Putting
your eye or pointing the telescope anywhere else will mean you won't view what I want you to view!

That said, I want to add that OFBiz developers are often extremely busy. Our comments (if I dare
consider myself part of the flock!) are sometimes not entirely definitive. We get blind spots at
different times of the day, just like everybody else. We do need to discuss stuff to get a clearer
perspective. And I still subscribe to the belief that hindsight is always more accurate than
foresight. We need discussions.

 > The "expert" in this "modelling" are database systems, and they do have
 > this kind of filtering in their views (as SQL prompts in its standard).

Hehe. Yes, you're right. But do bear in mind that OFBiz is not an "expert data modelling"
software. I would advise you not to get too involved here in discussing "whatever is the standard
RDBMS behavior". OFBiz is mostly developed with PostgreSQL. You'll be very safe if you run with
that as well. For other RDBMSes, some small tweaks may be RARELY needed.

 > Just tell me what can we do to add this "feature request" to JIRA and
 > I'll work on it. And then we could try to convince David to accept the
 > feature in OfBiz! :P

First, try exploring DynamicViewEntity. No, it still doesn't give us "View Filtering". But you
won't have to define a hundred and one slightly different view entities just to cater to your
various data-mining situations. Exploring DynamicViewEntity will also give you a better idea of
how my enhancement works.

Next, consider adding the "filter condition" in the <view-link> element instead. It makes more
sense there. Anyway, my implementation puts it there! :P

Then, you'll have to ask the core OFBiz guys how to create this "feature request" in JIRA. A
horrible bad habit of mine is that I am an absolute slob when it comes to documenting stuff. I
just code, solve maths puzzles, eat like the glutton that I am, that's all. :)

Jonathon

opablo wrote:

> Hi Jonathon,
>
> I've been reading the thread you posted, and I think you've got a point
> presenting the example: it is one classic situation where filtering is
> needed (or at least avoids many headaches!).
>
> I also read David's post:
>
>> In general entity and view entity definitions are meant to model
>> structure, not query constraints. Just add your desired constraints to
>> the EntityCondition passed into the findByCondition call (or Map for
>> findByAnd or whatever).
>>
>> -David
>
> and I only want to add that views don't model structure, they model only
> a view of the data (filtered and not filtered). Tables (entities) are
> what model the structure.
>
> The "expert" in this "modelling" are database systems, and they do have
> this kind of filtering in their views (as SQL prompts in its standard).
>
> Just tell me what can we do to add this "feature request" to JIRA and
> I'll work on it. And then we could try to convince David to accept the
> feature in OfBiz! :P
>
> Oscar
>
> On Mon, 2007-09-10 at 18:50 +0800, Jonathon -- Improov wrote:
>> Hi Oscar,
>>
>> I started a thread on it quite recently. See
>> http://www.nabble.com/forum/ViewPost.jtp?post=12018323&framed=y .
>>
>> I don't see any possibility in the current Entity Engine to do what we want.
>>
>> I have my own implementation to do this, since there wasn't any interest from OFBiz ML to get this
>> functionality into OFBiz SVN.
>>
>> In fact, I seem to have been compiling quite a sizable pile of enhancements I haven't been able to
>> put back into OFBiz SVN! There are other enhancements, in the Widget department, the Entity
>> Engine, the Minilang, etc.
>>
>> If you can help me document this "feature request" in the JIRA issues, help iron out the details
>> and community requirements and thoughts on this, I'll put in my enhancement right there.
>>
>> Jonathon
>>
>> opablo wrote:
>>> Hi all,
>>>
>>> Since I began working with OfBiz I missed a feature in its entity
>>> engine: some feature to allow to include some sort of filtering in the
>>> view definition. I'm talking about a code like the following (the
>>> "filter" tag):
>>>
>>> <view-entity entity-name="Suppliers"
>>> package-name="the.package.name"
>>>         title="List of suppliers">
>>>         <member-entity entity-alias="PR" entity-name="Party_Role"/>
>>>
>>>         <alias-all entity-alias="PR"/>
>>>
>>>         <view-link entity-alias="PR" rel-entity-alias="P">
>>>             <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
>>>         </view-link>
>>>
>>>         <filter entity-alias="PR">
>>>             <key-map field-name="roleTypeId" value="SUPPLIER">
>>>    </key-map>
>>>         </filter>
>>>     </view-entity>    
>>>
>>> I know I can do the filtering when obtaining the data by code just by
>>> adding the filter condition, but when views grow, it is easier to
>>> organize your views into "functional" areas, or even it helps when
>>> querying and browsing data in webtools tab.
>>>
>>> Is it in the roadmap for next versions? Has anyone discussed about this
>>> previously?
>>>
>>> Thanxs,
>>>
>>> Oscar
>>>
>>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: View filtering

Jacques Le Roux
Administrator
In reply to this post by opablo
Yes this might be interesting, I'm not sure either David is really opposed. Especially if someone provides a patch well tested !

http://docs.ofbiz.org/display/OFBADMIN/OFBiz+Contributors+Best+Practices

Jacques

De : "opablo" <[hidden email]>

> Hi Jonathon,
>
> I've been reading the thread you posted, and I think you've got a point
> presenting the example: it is one classic situation where filtering is
> needed (or at least avoids many headaches!).
>
> I also read David's post:
>
> >In general entity and view entity definitions are meant to model
> >structure, not query constraints. Just add your desired constraints to
> >the EntityCondition passed into the findByCondition call (or Map for
> >findByAnd or whatever).
> >
> >-David
>
> and I only want to add that views don't model structure, they model only
> a view of the data (filtered and not filtered). Tables (entities) are
> what model the structure.
>
> The "expert" in this "modelling" are database systems, and they do have
> this kind of filtering in their views (as SQL prompts in its standard).
>
> Just tell me what can we do to add this "feature request" to JIRA and
> I'll work on it. And then we could try to convince David to accept the
> feature in OfBiz! :P
>
> Oscar
>
> On Mon, 2007-09-10 at 18:50 +0800, Jonathon -- Improov wrote:
> > Hi Oscar,
> >
> > I started a thread on it quite recently. See
> > http://www.nabble.com/forum/ViewPost.jtp?post=12018323&framed=y .
> >
> > I don't see any possibility in the current Entity Engine to do what we want.
> >
> > I have my own implementation to do this, since there wasn't any interest from OFBiz ML to get this
> > functionality into OFBiz SVN.
> >
> > In fact, I seem to have been compiling quite a sizable pile of enhancements I haven't been able to
> > put back into OFBiz SVN! There are other enhancements, in the Widget department, the Entity
> > Engine, the Minilang, etc.
> >
> > If you can help me document this "feature request" in the JIRA issues, help iron out the details
> > and community requirements and thoughts on this, I'll put in my enhancement right there.
> >
> > Jonathon
> >
> > opablo wrote:
> > > Hi all,
> > >
> > > Since I began working with OfBiz I missed a feature in its entity
> > > engine: some feature to allow to include some sort of filtering in the
> > > view definition. I'm talking about a code like the following (the
> > > "filter" tag):
> > >
> > > <view-entity entity-name="Suppliers"
> > > package-name="the.package.name"
> > >         title="List of suppliers">
> > >         <member-entity entity-alias="PR" entity-name="Party_Role"/>
> > >
> > >         <alias-all entity-alias="PR"/>
> > >
> > >         <view-link entity-alias="PR" rel-entity-alias="P">
> > >             <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
> > >         </view-link>
> > >
> > >         <filter entity-alias="PR">
> > >             <key-map field-name="roleTypeId" value="SUPPLIER">
> > >     </key-map>
> > >         </filter>
> > >     </view-entity>    
> > >
> > > I know I can do the filtering when obtaining the data by code just by
> > > adding the filter condition, but when views grow, it is easier to
> > > organize your views into "functional" areas, or even it helps when
> > > querying and browsing data in webtools tab.
> > >
> > > Is it in the roadmap for next versions? Has anyone discussed about this
> > > previously?
> > >
> > > Thanxs,
> > >
> > > Oscar
> > >
> > >
Reply | Threaded
Open this post in threaded view
|

Re: View filtering

opablo
In reply to this post by jonwimp
Hi,

A new issue has been just created at JIRA:
https://issues.apache.org/jira/browse/OFBIZ-1232

and the patch with the code is attached.

Thanks Jonathon and Jacques for your replies!

Oscar

On Mon, 2007-09-10 at 20:07 +0800, Jonathon -- Improov wrote:

> Hi Oscar,
>
>  > I also read David's post:
>  >
>  >> In general entity and view entity definitions are meant to model
>  >> structure, not query constraints. Just add your desired constraints to
>  >> the EntityCondition passed into the findByCondition call (or Map for
>  >> findByAnd or whatever).
>  >>
>  >> -David
>  >
>  > and I only want to add that views don't model structure, they model only
>  > a view of the data (filtered and not filtered). Tables (entities) are
>  > what model the structure.
>
> I had neglected to add that your "View filtering" thread had put forth the issue more eloquently
> than I had in my own thread. :) Yes, views don't model structure but model views instead. And
> views are inherently conditional, like "Put your eye squarely on the smaller end of the telescope,
> and point the telescope in a SPECIFIC direction, and you'll see what I wanted you to see". Putting
> your eye or pointing the telescope anywhere else will mean you won't view what I want you to view!
>
> That said, I want to add that OFBiz developers are often extremely busy. Our comments (if I dare
> consider myself part of the flock!) are sometimes not entirely definitive. We get blind spots at
> different times of the day, just like everybody else. We do need to discuss stuff to get a clearer
> perspective. And I still subscribe to the belief that hindsight is always more accurate than
> foresight. We need discussions.
>
>  > The "expert" in this "modelling" are database systems, and they do have
>  > this kind of filtering in their views (as SQL prompts in its standard).
>
> Hehe. Yes, you're right. But do bear in mind that OFBiz is not an "expert data modelling"
> software. I would advise you not to get too involved here in discussing "whatever is the standard
> RDBMS behavior". OFBiz is mostly developed with PostgreSQL. You'll be very safe if you run with
> that as well. For other RDBMSes, some small tweaks may be RARELY needed.
>
>  > Just tell me what can we do to add this "feature request" to JIRA and
>  > I'll work on it. And then we could try to convince David to accept the
>  > feature in OfBiz! :P
>
> First, try exploring DynamicViewEntity. No, it still doesn't give us "View Filtering". But you
> won't have to define a hundred and one slightly different view entities just to cater to your
> various data-mining situations. Exploring DynamicViewEntity will also give you a better idea of
> how my enhancement works.
>
> Next, consider adding the "filter condition" in the <view-link> element instead. It makes more
> sense there. Anyway, my implementation puts it there! :P
>
> Then, you'll have to ask the core OFBiz guys how to create this "feature request" in JIRA. A
> horrible bad habit of mine is that I am an absolute slob when it comes to documenting stuff. I
> just code, solve maths puzzles, eat like the glutton that I am, that's all. :)
>
> Jonathon
>
> opablo wrote:
> > Hi Jonathon,
> >
> > I've been reading the thread you posted, and I think you've got a point
> > presenting the example: it is one classic situation where filtering is
> > needed (or at least avoids many headaches!).
> >
> > I also read David's post:
> >
> >> In general entity and view entity definitions are meant to model
> >> structure, not query constraints. Just add your desired constraints to
> >> the EntityCondition passed into the findByCondition call (or Map for
> >> findByAnd or whatever).
> >>
> >> -David
> >
> > and I only want to add that views don't model structure, they model only
> > a view of the data (filtered and not filtered). Tables (entities) are
> > what model the structure.
> >
> > The "expert" in this "modelling" are database systems, and they do have
> > this kind of filtering in their views (as SQL prompts in its standard).
> >
> > Just tell me what can we do to add this "feature request" to JIRA and
> > I'll work on it. And then we could try to convince David to accept the
> > feature in OfBiz! :P
> >
> > Oscar
> >
> > On Mon, 2007-09-10 at 18:50 +0800, Jonathon -- Improov wrote:
> >> Hi Oscar,
> >>
> >> I started a thread on it quite recently. See
> >> http://www.nabble.com/forum/ViewPost.jtp?post=12018323&framed=y .
> >>
> >> I don't see any possibility in the current Entity Engine to do what we want.
> >>
> >> I have my own implementation to do this, since there wasn't any interest from OFBiz ML to get this
> >> functionality into OFBiz SVN.
> >>
> >> In fact, I seem to have been compiling quite a sizable pile of enhancements I haven't been able to
> >> put back into OFBiz SVN! There are other enhancements, in the Widget department, the Entity
> >> Engine, the Minilang, etc.
> >>
> >> If you can help me document this "feature request" in the JIRA issues, help iron out the details
> >> and community requirements and thoughts on this, I'll put in my enhancement right there.
> >>
> >> Jonathon
> >>
> >> opablo wrote:
> >>> Hi all,
> >>>
> >>> Since I began working with OfBiz I missed a feature in its entity
> >>> engine: some feature to allow to include some sort of filtering in the
> >>> view definition. I'm talking about a code like the following (the
> >>> "filter" tag):
> >>>
> >>> <view-entity entity-name="Suppliers"
> >>> package-name="the.package.name"
> >>>         title="List of suppliers">
> >>>         <member-entity entity-alias="PR" entity-name="Party_Role"/>
> >>>
> >>>         <alias-all entity-alias="PR"/>
> >>>
> >>>         <view-link entity-alias="PR" rel-entity-alias="P">
> >>>             <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
> >>>         </view-link>
> >>>
> >>>         <filter entity-alias="PR">
> >>>             <key-map field-name="roleTypeId" value="SUPPLIER">
> >>>    </key-map>
> >>>         </filter>
> >>>     </view-entity>    
> >>>
> >>> I know I can do the filtering when obtaining the data by code just by
> >>> adding the filter condition, but when views grow, it is easier to
> >>> organize your views into "functional" areas, or even it helps when
> >>> querying and browsing data in webtools tab.
> >>>
> >>> Is it in the roadmap for next versions? Has anyone discussed about this
> >>> previously?
> >>>
> >>> Thanxs,
> >>>
> >>> Oscar
> >>>
> >>>
> >
> >