drop-down with entity option filtered by dates?

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

drop-down with entity option filtered by dates?

Amine Benkirane
   Hi there !

It is possible to filter a drop-down with entity-options by date ? Basically, I want my drop-down to show only the records from an entity which between the fromDate and thruDate.

I make a search in ofbiz but I didn't find anything like that...

Regards,

Amine

_________________________________________________________________
Installez gratuitement les 20 émôticones Windows Live Messenger les plus fous ! Cliquez ici !
http://www.emoticones-messenger.fr/
Reply | Threaded
Open this post in threaded view
|

Re: drop-down with entity option filtered by dates?

BJ Freeman
you can use the groovy to create the list you need like
look at any dropdown page and find the groovy file for it.
then just use the created list for drop down.

Amine Benkirane sent the following on 9/19/2008 3:27 AM:

>    Hi there !
>
> It is possible to filter a drop-down with entity-options by date ? Basically, I want my drop-down to show only the records from an entity which between the fromDate and thruDate.
>
> I make a search in ofbiz but I didn't find anything like that...
>
> Regards,
>
> Amine
>
> _________________________________________________________________
> Installez gratuitement les 20 émôticones Windows Live Messenger les plus fous ! Cliquez ici !
> http://www.emoticones-messenger.fr/


Reply | Threaded
Open this post in threaded view
|

RE: drop-down with entity option filtered by dates?

Amine Benkirane

Ok and thank you for your response but I use a drop-down directly in ScreenForm like this
 <form name="AddNewsToParty" type="single" target="addNewsToParty" title=""
        header-row-style="header-row" default-table-style="basic-table">
        <auto-fields-service service-name="addNewsToParty"/>
        <field name="partyId" map-name="party"><hidden/></field>
        <field name="newsId" title="${uiLabelMap.NewsTitle}">
            <drop-down>                <entity-options entity-name="News" description="${title}" key-field-name="newsId">                    <entity-constraint name="createdBy" operator="equals" env-name="userLogin.userLoginId"/>                    <entity-order-by field-name="title"/>                </entity-options>            </drop-down>
            <!--lookup target-form-name="LookupNewsRequest"></lookup-->
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>


And here, I want to add entity-constraints using dates, something like :
 <entity-constraint name="fromDate" operator="greater_than_equal_to" env-name="currentDate"/>
 <entity-constraint name="thruDate" operator="less_than_equal_to" env-name="currentDate"/>


Is stuff like this possible ?

Regards,

Amine


> Date: Fri, 19 Sep 2008 04:49:03 -0700
> From: [hidden email]
> To: [hidden email]
> Subject: Re: drop-down with entity option filtered by dates?
>
> you can use the groovy to create the list you need like
> look at any dropdown page and find the groovy file for it.
> then just use the created list for drop down.
>
> Amine Benkirane sent the following on 9/19/2008 3:27 AM:
> >    Hi there !
> >
> > It is possible to filter a drop-down with entity-options by date ? Basically, I want my drop-down to show only the records from an entity which between the fromDate and thruDate.
> >
> > I make a search in ofbiz but I didn't find anything like that...
> >
> > Regards,
> >
> > Amine
> >
> > _________________________________________________________________
> > Installez gratuitement les 20 émôticones Windows Live Messenger les plus fous ! Cliquez ici !
> > http://www.emoticones-messenger.fr/
>
>

_________________________________________________________________
Email envoyé avec Windows Live Hotmail. Dites adieux aux spam et virus, passez à Hotmail ! C'est gratuit !
http://www.windowslive.fr/hotmail/default.asp
Reply | Threaded
Open this post in threaded view
|

Re: drop-down with entity option filtered by dates?

BJ Freeman
I bumped up a previous email thread.
the email archives a great resource and should be researched.


Amine Benkirane sent the following on 9/19/2008 7:39 AM:

> Ok and thank you for your response but I use a drop-down directly in ScreenForm like this
>  <form name="AddNewsToParty" type="single" target="addNewsToParty" title=""
>         header-row-style="header-row" default-table-style="basic-table">
>         <auto-fields-service service-name="addNewsToParty"/>
>         <field name="partyId" map-name="party"><hidden/></field>
>         <field name="newsId" title="${uiLabelMap.NewsTitle}">
>             <drop-down>                <entity-options entity-name="News" description="${title}" key-field-name="newsId">                    <entity-constraint name="createdBy" operator="equals" env-name="userLogin.userLoginId"/>                    <entity-order-by field-name="title"/>                </entity-options>            </drop-down>
>             <!--lookup target-form-name="LookupNewsRequest"></lookup-->
>         </field>
>         <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
>     </form>
>
>
> And here, I want to add entity-constraints using dates, something like :
>  <entity-constraint name="fromDate" operator="greater_than_equal_to" env-name="currentDate"/>
>  <entity-constraint name="thruDate" operator="less_than_equal_to" env-name="currentDate"/>
>
>
> Is stuff like this possible ?
>
> Regards,
>
> Amine
>
>
>> Date: Fri, 19 Sep 2008 04:49:03 -0700
>> From: [hidden email]
>> To: [hidden email]
>> Subject: Re: drop-down with entity option filtered by dates?
>>
>> you can use the groovy to create the list you need like
>> look at any dropdown page and find the groovy file for it.
>> then just use the created list for drop down.
>>
>> Amine Benkirane sent the following on 9/19/2008 3:27 AM:
>>>    Hi there !
>>>
>>> It is possible to filter a drop-down with entity-options by date ? Basically, I want my drop-down to show only the records from an entity which between the fromDate and thruDate.
>>>
>>> I make a search in ofbiz but I didn't find anything like that...
>>>
>>> Regards,
>>>
>>> Amine
>>>
>>> _________________________________________________________________
>>> Installez gratuitement les 20 émôticones Windows Live Messenger les plus fous ! Cliquez ici !
>>> http://www.emoticones-messenger.fr/
>>
>
> _________________________________________________________________
> Email envoyé avec Windows Live Hotmail. Dites adieux aux spam et virus, passez à Hotmail ! C'est gratuit !
> http://www.windowslive.fr/hotmail/default.asp


Reply | Threaded
Open this post in threaded view
|

Re: drop-down with entity option filtered by dates?

Bruno Busco
Amine,
the <entity-constraint> inside the <entity-options> does work. I have found
los into OFBiz with the "equal" operator but I am sure it will work with
every operator. Just try it!
-Bruno

2008/9/19 BJ Freeman <[hidden email]>

> I bumped up a previous email thread.
> the email archives a great resource and should be researched.
>
>
> Amine Benkirane sent the following on 9/19/2008 7:39 AM:
> > Ok and thank you for your response but I use a drop-down directly in
> ScreenForm like this
> >  <form name="AddNewsToParty" type="single" target="addNewsToParty"
> title=""
> >         header-row-style="header-row" default-table-style="basic-table">
> >         <auto-fields-service service-name="addNewsToParty"/>
> >         <field name="partyId" map-name="party"><hidden/></field>
> >         <field name="newsId" title="${uiLabelMap.NewsTitle}">
> >             <drop-down>                <entity-options entity-name="News"
> description="${title}" key-field-name="newsId">
>  <entity-constraint name="createdBy" operator="equals"
> env-name="userLogin.userLoginId"/>                    <entity-order-by
> field-name="title"/>                </entity-options>
>  </drop-down>
> >             <!--lookup target-form-name="LookupNewsRequest"></lookup-->
> >         </field>
> >         <field name="submitButton" title="${uiLabelMap.CommonAdd}"
> widget-style="smallSubmit"><submit button-type="button"/></field>
> >     </form>
> >
> >
> > And here, I want to add entity-constraints using dates, something like :
> >  <entity-constraint name="fromDate" operator="greater_than_equal_to"
> env-name="currentDate"/>
> >  <entity-constraint name="thruDate" operator="less_than_equal_to"
> env-name="currentDate"/>
> >
> >
> > Is stuff like this possible ?
> >
> > Regards,
> >
> > Amine
> >
> >
> >> Date: Fri, 19 Sep 2008 04:49:03 -0700
> >> From: [hidden email]
> >> To: [hidden email]
> >> Subject: Re: drop-down with entity option filtered by dates?
> >>
> >> you can use the groovy to create the list you need like
> >> look at any dropdown page and find the groovy file for it.
> >> then just use the created list for drop down.
> >>
> >> Amine Benkirane sent the following on 9/19/2008 3:27 AM:
> >>>    Hi there !
> >>>
> >>> It is possible to filter a drop-down with entity-options by date ?
> Basically, I want my drop-down to show only the records from an entity which
> between the fromDate and thruDate.
> >>>
> >>> I make a search in ofbiz but I didn't find anything like that...
> >>>
> >>> Regards,
> >>>
> >>> Amine
> >>>
> >>> _________________________________________________________________
> >>> Installez gratuitement les 20 émôticones Windows Live Messenger les
> plus fous ! Cliquez ici !
> >>> http://www.emoticones-messenger.fr/
> >>
> >
> > _________________________________________________________________
> > Email envoyé avec Windows Live Hotmail. Dites adieux aux spam et virus,
> passez à Hotmail ! C'est gratuit !
> > http://www.windowslive.fr/hotmail/default.asp
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: drop-down with entity option filtered by dates? [RESOLVED]

Amine Benkirane
Hi Bruno,
 
Thank you for your response ! I have tried the code I put in my previous email but I had this error :
org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen [component://common/widget/CommonScreens.xml#GlobalDecorator]: java.lang.IllegalArgumentException: Could not find an entity operator for the name: greater_than_equal_to (Could not find an entity operator for the name: greater_than_equal_to)
 
 
So, after some ofbiz researches and lot of testing, I found the right code and this time, I don't forget to give the way to resolve this trouble ;). The code to use is something similar to this
 
<field name="newsId" title="${uiLabelMap.NewsTitle}">
<drop-down>
<entity-options entity-name="News" description="${title}" key-field-name="newsId">
<entity-constraint name="createdBy" operator="equals" env-name="userLogin.userLoginId"/>
<entity-constraint name="fromDate" operator="less-equals" env-name="nowTimestamp"/>
<entity-constraint name="thruDate" operator="greater" env-name="nowTimestamp"/>
<entity-order-by field-name="title"/>
</entity-options>
</drop-down>
</field>
 
This assumes that fromDate and thruDate are datafields of the News entity in date-time format (I had them in date type and I met a ClassCastException java.sql.Date because of nowTimestamp which return a java.sql.Timestamp).
 
Finally this code is very close to what I had tried initially :)...
 
Regards,
 
Amine




> Date: Fri, 19 Sep 2008 22:54:42 +0200> From: [hidden email]> To: [hidden email]> Subject: Re: drop-down with entity option filtered by dates?> > Amine,> the <entity-constraint> inside the <entity-options> does work. I have found> los into OFBiz with the "equal" operator but I am sure it will work with> every operator. Just try it!> -Bruno> > 2008/9/19 BJ Freeman <[hidden email]>> > > I bumped up a previous email thread.> > the email archives a great resource and should be researched.> >> >> > Amine Benkirane sent the following on 9/19/2008 7:39 AM:> > > Ok and thank you for your response but I use a drop-down directly in> > ScreenForm like this> > > <form name="AddNewsToParty" type="single" target="addNewsToParty"> > title=""> > > header-row-style="header-row" default-table-style="basic-table">> > > <auto-fields-service service-name="addNewsToParty"/>> > > <field name="partyId" map-name="party"><hidden/></field>> > > <field name="newsId" title="${uiLabelMap.NewsTitle}">> > > <drop-down> <entity-options entity-name="News"> > description="${title}" key-field-name="newsId">> > <entity-constraint name="createdBy" operator="equals"> > env-name="userLogin.userLoginId"/> <entity-order-by> > field-name="title"/> </entity-options>> > </drop-down>> > > <!--lookup target-form-name="LookupNewsRequest"></lookup-->> > > </field>> > > <field name="submitButton" title="${uiLabelMap.CommonAdd}"> > widget-style="smallSubmit"><submit button-type="button"/></field>> > > </form>> > >> > >> > > And here, I want to add entity-constraints using dates, something like :> > > <entity-constraint name="fromDate" operator="greater_than_equal_to"> > env-name="currentDate"/>> > > <entity-constraint name="thruDate" operator="less_than_equal_to"> > env-name="currentDate"/>> > >> > >> > > Is stuff like this possible ?> > >> > > Regards,> > >> > > Amine> > >> > >> > >> Date: Fri, 19 Sep 2008 04:49:03 -0700> > >> From: [hidden email]> > >> To: [hidden email]> > >> Subject: Re: drop-down with entity option filtered by dates?> > >>> > >> you can use the groovy to create the list you need like> > >> look at any dropdown page and find the groovy file for it.> > >> then just use the created list for drop down.> > >>> > >> Amine Benkirane sent the following on 9/19/2008 3:27 AM:> > >>> Hi there !> > >>>> > >>> It is possible to filter a drop-down with entity-options by date ?> > Basically, I want my drop-down to show only the records from an entity which> > between the fromDate and thruDate.> > >>>> > >>> I make a search in ofbiz but I didn't find anything like that...> > >>>> > >>> Regards,> > >>>> > >>> Amine> > >>>> > >>> _________________________________________________________________> > >>> Installez gratuitement les 20 émôticones Windows Live Messenger les> > plus fous ! Cliquez ici !> > >>> http://www.emoticones-messenger.fr/> > >>> > >> > > _________________________________________________________________> > > Email envoyé avec Windows Live Hotmail. Dites adieux aux spam et virus,> > passez à Hotmail ! C'est gratuit !> > > http://www.windowslive.fr/hotmail/default.asp> >> >> >
_________________________________________________________________
Installez gratuitement les 20 émôticones Windows Live Messenger les plus fous ! Cliquez ici !
http://www.emoticones-messenger.fr/