You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Nicolas Malin <ma...@librenberry.net> on 2010/09/16 12:17:41 UTC

Filter search entity list with date value on forms

Hi,

I tred to find all productPrice associated to a workEffort and filter 
them by the workEffort.actualStartDate value. To achieve that I used in 
the form's action an entity-condition like this one :

<entity-condition entity-name="ProductPrice" list="listIt" >
<condition-list>
<condition-expr field-name="fromDate" 
from-field="workEffort.actualStartDate" operator="less-equals"/>
<condition-expr field-name="thruDate" 
from-field="workEffort.actualStartDate" operator="greater-equals"/>
<condition-expr field-name="productId" from-field="workEffort.productId"/>
</condition-list>
</entity-condition>

This is working fine but only if the ProductPrice.thruDate exists. If I 
use :
<entity-condition entity-name="ProductPrice" list="listIt" 
filter-by-date="true">
The filter isn't anymore with workEffort.actualStartDate but with 
nowTimestamp value. It's not my goal.

After a quick search I extended ListFinder.java to add a new attribute : 
filter-with-date-value to have the possibility to give a date value to 
filter. Now I can do :
<entity-condition entity-name="ProductPrice" list="listIt" 
filter-with-date-value="${workEffort.actualStartDate}" >
<condition-list>
<condition-expr field-name="productId" from-field="workEffort.productId"/>
</condition-list>
</entity-condition>

I opened a jira issue to submit this improvment or is there already a 
solution for doing this?
Any suggestions are welcome !


Nicolas

-- 
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/


Re: Filter search entity list with date value on forms

Posted by Nicolas Malin <ma...@librenberry.net>.
Yes your right also scott ;)

My solution is quick correction but not a global analyse. I don't have 
time to make more but I create a jira to keep idea and have a task 
remerber ;)
I works on it asap.

Nicolas

Le 16/09/2010 13:48, Scott Gray a écrit :
> Oh right, I see what you mean.
>
> About adding the new attribute, my preference would be to see a new element specifically for date filtering.  Maybe after this problem is solved someone will come along and say that they need to filter on date fields that aren't called fromDate and thruDate.  Or perhaps someone will wanted to filter against a date range instead of a single moment i.e. all prices active at some point during August.  A new element would help us avoid clutter on the main entity-condition element.
>
> Regards
> Scott
>
> On 16/09/2010, at 11:10 PM, Nicolas Malin wrote:
>
>    
>> Hi Scott, it was my first idea, but ignore-if-null and ignore-if-empty works on given value and not search attribute.
>>
>> Nicolas
>>
>> Le 16/09/2010 12:51, Scott Gray a écrit :
>>      
>>> Hi Nicolas,
>>>
>>> No comment right now on your suggestion but just as an FYI, condition-expr has ignore-if-null and ignore-if-empty attributes to avoid the problem you described with your initial attempt.
>>>
>>> Regards
>>> Scott
>>>
>>> HotWax Media
>>> http://www.hotwaxmedia.com
>>>
>>> On 16/09/2010, at 10:17 PM, Nicolas Malin wrote:
>>>
>>>
>>>        
>>>> Hi,
>>>>
>>>> I tred to find all productPrice associated to a workEffort and filter them by the workEffort.actualStartDate value. To achieve that I used in the form's action an entity-condition like this one :
>>>>
>>>> <entity-condition entity-name="ProductPrice" list="listIt">
>>>> <condition-list>
>>>> <condition-expr field-name="fromDate" from-field="workEffort.actualStartDate" operator="less-equals"/>
>>>> <condition-expr field-name="thruDate" from-field="workEffort.actualStartDate" operator="greater-equals"/>
>>>> <condition-expr field-name="productId" from-field="workEffort.productId"/>
>>>> </condition-list>
>>>> </entity-condition>
>>>>
>>>> This is working fine but only if the ProductPrice.thruDate exists. If I use :
>>>> <entity-condition entity-name="ProductPrice" list="listIt" filter-by-date="true">
>>>> The filter isn't anymore with workEffort.actualStartDate but with nowTimestamp value. It's not my goal.
>>>>
>>>> After a quick search I extended ListFinder.java to add a new attribute : filter-with-date-value to have the possibility to give a date value to filter. Now I can do :
>>>> <entity-condition entity-name="ProductPrice" list="listIt" filter-with-date-value="${workEffort.actualStartDate}">
>>>> <condition-list>
>>>> <condition-expr field-name="productId" from-field="workEffort.productId"/>
>>>> </condition-list>
>>>> </entity-condition>
>>>>
>>>> I opened a jira issue to submit this improvment or is there already a solution for doing this?
>>>> Any suggestions are welcome !
>>>>
>>>>
>>>> Nicolas
>>>>
>>>> -- 
>>>> Nicolas MALIN
>>>> Consultant
>>>> Tél : 06.17.66.40.06
>>>> Site projet : http://www.neogia.org/
>>>> -------
>>>> Société LibrenBerry
>>>> Tél : 02.48.02.56.12
>>>> Site : http://www.librenberry.net/
>>>>
>>>>
>>>>          
>>>
>>>        
>>
>> -- 
>> Nicolas MALIN
>> Consultant
>> Tél : 06.17.66.40.06
>> Site projet : http://www.neogia.org/
>> -------
>> Société LibrenBerry
>> Tél : 02.48.02.56.12
>> Site : http://www.librenberry.net/
>>
>>      
>    


-- 
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/


Re: Filter search entity list with date value on forms

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Oh right, I see what you mean.

About adding the new attribute, my preference would be to see a new element specifically for date filtering.  Maybe after this problem is solved someone will come along and say that they need to filter on date fields that aren't called fromDate and thruDate.  Or perhaps someone will wanted to filter against a date range instead of a single moment i.e. all prices active at some point during August.  A new element would help us avoid clutter on the main entity-condition element.

Regards
Scott

On 16/09/2010, at 11:10 PM, Nicolas Malin wrote:

> Hi Scott, it was my first idea, but ignore-if-null and ignore-if-empty works on given value and not search attribute.
> 
> Nicolas
> 
> Le 16/09/2010 12:51, Scott Gray a écrit :
>> Hi Nicolas,
>> 
>> No comment right now on your suggestion but just as an FYI, condition-expr has ignore-if-null and ignore-if-empty attributes to avoid the problem you described with your initial attempt.
>> 
>> Regards
>> Scott
>> 
>> HotWax Media
>> http://www.hotwaxmedia.com
>> 
>> On 16/09/2010, at 10:17 PM, Nicolas Malin wrote:
>> 
>>   
>>> Hi,
>>> 
>>> I tred to find all productPrice associated to a workEffort and filter them by the workEffort.actualStartDate value. To achieve that I used in the form's action an entity-condition like this one :
>>> 
>>> <entity-condition entity-name="ProductPrice" list="listIt">
>>> <condition-list>
>>> <condition-expr field-name="fromDate" from-field="workEffort.actualStartDate" operator="less-equals"/>
>>> <condition-expr field-name="thruDate" from-field="workEffort.actualStartDate" operator="greater-equals"/>
>>> <condition-expr field-name="productId" from-field="workEffort.productId"/>
>>> </condition-list>
>>> </entity-condition>
>>> 
>>> This is working fine but only if the ProductPrice.thruDate exists. If I use :
>>> <entity-condition entity-name="ProductPrice" list="listIt" filter-by-date="true">
>>> The filter isn't anymore with workEffort.actualStartDate but with nowTimestamp value. It's not my goal.
>>> 
>>> After a quick search I extended ListFinder.java to add a new attribute : filter-with-date-value to have the possibility to give a date value to filter. Now I can do :
>>> <entity-condition entity-name="ProductPrice" list="listIt" filter-with-date-value="${workEffort.actualStartDate}">
>>> <condition-list>
>>> <condition-expr field-name="productId" from-field="workEffort.productId"/>
>>> </condition-list>
>>> </entity-condition>
>>> 
>>> I opened a jira issue to submit this improvment or is there already a solution for doing this?
>>> Any suggestions are welcome !
>>> 
>>> 
>>> Nicolas
>>> 
>>> -- 
>>> Nicolas MALIN
>>> Consultant
>>> Tél : 06.17.66.40.06
>>> Site projet : http://www.neogia.org/
>>> -------
>>> Société LibrenBerry
>>> Tél : 02.48.02.56.12
>>> Site : http://www.librenberry.net/
>>> 
>>>     
>>   
> 
> 
> -- 
> Nicolas MALIN
> Consultant
> Tél : 06.17.66.40.06
> Site projet : http://www.neogia.org/
> -------
> Société LibrenBerry
> Tél : 02.48.02.56.12
> Site : http://www.librenberry.net/
> 


Re: Filter search entity list with date value on forms

Posted by Nicolas Malin <ma...@librenberry.net>.
Hi Scott, it was my first idea, but ignore-if-null and ignore-if-empty 
works on given value and not search attribute.

Nicolas

Le 16/09/2010 12:51, Scott Gray a écrit :
> Hi Nicolas,
>
> No comment right now on your suggestion but just as an FYI, condition-expr has ignore-if-null and ignore-if-empty attributes to avoid the problem you described with your initial attempt.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 16/09/2010, at 10:17 PM, Nicolas Malin wrote:
>
>    
>> Hi,
>>
>> I tred to find all productPrice associated to a workEffort and filter them by the workEffort.actualStartDate value. To achieve that I used in the form's action an entity-condition like this one :
>>
>> <entity-condition entity-name="ProductPrice" list="listIt">
>> <condition-list>
>> <condition-expr field-name="fromDate" from-field="workEffort.actualStartDate" operator="less-equals"/>
>> <condition-expr field-name="thruDate" from-field="workEffort.actualStartDate" operator="greater-equals"/>
>> <condition-expr field-name="productId" from-field="workEffort.productId"/>
>> </condition-list>
>> </entity-condition>
>>
>> This is working fine but only if the ProductPrice.thruDate exists. If I use :
>> <entity-condition entity-name="ProductPrice" list="listIt" filter-by-date="true">
>> The filter isn't anymore with workEffort.actualStartDate but with nowTimestamp value. It's not my goal.
>>
>> After a quick search I extended ListFinder.java to add a new attribute : filter-with-date-value to have the possibility to give a date value to filter. Now I can do :
>> <entity-condition entity-name="ProductPrice" list="listIt" filter-with-date-value="${workEffort.actualStartDate}">
>> <condition-list>
>> <condition-expr field-name="productId" from-field="workEffort.productId"/>
>> </condition-list>
>> </entity-condition>
>>
>> I opened a jira issue to submit this improvment or is there already a solution for doing this?
>> Any suggestions are welcome !
>>
>>
>> Nicolas
>>
>> -- 
>> Nicolas MALIN
>> Consultant
>> Tél : 06.17.66.40.06
>> Site projet : http://www.neogia.org/
>> -------
>> Société LibrenBerry
>> Tél : 02.48.02.56.12
>> Site : http://www.librenberry.net/
>>
>>      
>    


-- 
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/


Re: Filter search entity list with date value on forms

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Nicolas,

No comment right now on your suggestion but just as an FYI, condition-expr has ignore-if-null and ignore-if-empty attributes to avoid the problem you described with your initial attempt.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 16/09/2010, at 10:17 PM, Nicolas Malin wrote:

> Hi,
> 
> I tred to find all productPrice associated to a workEffort and filter them by the workEffort.actualStartDate value. To achieve that I used in the form's action an entity-condition like this one :
> 
> <entity-condition entity-name="ProductPrice" list="listIt" >
> <condition-list>
> <condition-expr field-name="fromDate" from-field="workEffort.actualStartDate" operator="less-equals"/>
> <condition-expr field-name="thruDate" from-field="workEffort.actualStartDate" operator="greater-equals"/>
> <condition-expr field-name="productId" from-field="workEffort.productId"/>
> </condition-list>
> </entity-condition>
> 
> This is working fine but only if the ProductPrice.thruDate exists. If I use :
> <entity-condition entity-name="ProductPrice" list="listIt" filter-by-date="true">
> The filter isn't anymore with workEffort.actualStartDate but with nowTimestamp value. It's not my goal.
> 
> After a quick search I extended ListFinder.java to add a new attribute : filter-with-date-value to have the possibility to give a date value to filter. Now I can do :
> <entity-condition entity-name="ProductPrice" list="listIt" filter-with-date-value="${workEffort.actualStartDate}" >
> <condition-list>
> <condition-expr field-name="productId" from-field="workEffort.productId"/>
> </condition-list>
> </entity-condition>
> 
> I opened a jira issue to submit this improvment or is there already a solution for doing this?
> Any suggestions are welcome !
> 
> 
> Nicolas
> 
> -- 
> Nicolas MALIN
> Consultant
> Tél : 06.17.66.40.06
> Site projet : http://www.neogia.org/
> -------
> Société LibrenBerry
> Tél : 02.48.02.56.12
> Site : http://www.librenberry.net/
>