You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by ian tabangay <it...@gmail.com> on 2008/11/19 11:44:34 UTC

Comparing columns in an entity

Hi.
How do you do an EntityCondition wherein you need to compare the values of
the 2 columns within the entity?
Thanks.


~ ian

Re: Comparing columns in an entity

Posted by Malin Nicolas <ma...@librenberry.net>.
I never used the delegator in this purpose. I think it's not possible 
and need extend EntityCondition to support this.

Nicolas

ian tabangay a écrit :
> That's not really very efficient especially if youre trying to find a few
> items from a hundred thousand. Putting it in a list would easily give you an
> OutOfMemoryException. I have a workaround for this but its done using
> SQLProcessor which could be problematic later on. Any other suggestions?
>
> On Thu, Nov 20, 2008 at 6:15 PM, Bilgin Ibryam <bi...@iguanait.com> wrote:
>
>   
>> One way could be
>>
>> values = delegator.findList("EntityName", null, null, null, null, true);
>> List field1Values = EntityUtil.getFieldListFromEntityList(values, "field1",
>> true);
>> finalValues = delegator.findList("EntityName",
>> EntityCondition.makeCondition("field2", EntityOperator.IN, field1Values),
>> null, null, null, true);
>>
>> Bilgin
>>
>>
>> On Nov 20, 2008, at 5:01 AM, ian tabangay wrote:
>>
>>  i am familiar with findList and how to use EntityConditionList and
>>     
>>> EntityExpr. But i am only familiar with comparing a column with a given
>>> value (like new EntityExpr("columnName", EntityOperator.EQUALS, value).
>>> What
>>> i wanted to do is to compare 2 columns of an entity. For example, if it
>>> were
>>> written as an SQL, it would be something like "SELECT column_a, column_b
>>> FROM table WHERE column_a = column_b"
>>>
>>> On Wed, Nov 19, 2008 at 9:17 PM, BJ Freeman <bj...@free-man.net> wrote:
>>>
>>>  do a search in code for findList
>>>       
>
>   


-- 
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: Comparing columns in an entity

Posted by ian tabangay <it...@gmail.com>.
I see. thanks.

On Fri, Nov 21, 2008 at 6:06 PM, BJ Freeman <bj...@free-man.net> wrote:

> Hopefully the people that have done the refactoring will respond.
> I have never run across the requirement myself.
> even in SQL.

Re: Comparing columns in an entity

Posted by BJ Freeman <bj...@free-man.net>.
Hopefully the people that have done the refactoring will respond.
I have never run across the requirement myself.
even in SQL.

ian tabangay sent the following on 11/20/2008 7:23 PM:
> oh ok. thank you for all who responded.
> BJ, would you happen to know why this wasnt implemented?
> im pretty sure this is not the first time this scenario had been
> encountered.
> 
> 
> On Fri, Nov 21, 2008 at 3:26 AM, BJ Freeman <bj...@free-man.net> wrote:
> 
>> your other options is to go to the dev mailing list and propose a change
>> that you are willing to do, that would allow this function.
>> Not saying you will get a positive response, but it is worth a shot.
>> if you get a positive response they will tell you the next step.
>>
> 

Re: Comparing columns in an entity

Posted by ian tabangay <it...@gmail.com>.
oh ok. thank you for all who responded.
BJ, would you happen to know why this wasnt implemented?
im pretty sure this is not the first time this scenario had been
encountered.


On Fri, Nov 21, 2008 at 3:26 AM, BJ Freeman <bj...@free-man.net> wrote:

> your other options is to go to the dev mailing list and propose a change
> that you are willing to do, that would allow this function.
> Not saying you will get a positive response, but it is worth a shot.
> if you get a positive response they will tell you the next step.
>

Re: Comparing columns in an entity

Posted by BJ Freeman <bj...@free-man.net>.
your other options is to go to the dev mailing list and propose a change
that you are willing to do, that would allow this function.
Not saying you will get a positive response, but it is worth a shot.
if you get a positive response they will tell you the next step.


ian tabangay sent the following on 11/20/2008 4:30 AM:
> That's not really very efficient especially if youre trying to find a few
> items from a hundred thousand. Putting it in a list would easily give you an
> OutOfMemoryException. I have a workaround for this but its done using
> SQLProcessor which could be problematic later on. Any other suggestions?
> 
> On Thu, Nov 20, 2008 at 6:15 PM, Bilgin Ibryam <bi...@iguanait.com> wrote:
> 
>> One way could be
>>
>> values = delegator.findList("EntityName", null, null, null, null, true);
>> List field1Values = EntityUtil.getFieldListFromEntityList(values, "field1",
>> true);
>> finalValues = delegator.findList("EntityName",
>> EntityCondition.makeCondition("field2", EntityOperator.IN, field1Values),
>> null, null, null, true);
>>
>> Bilgin
>>
>>
>> On Nov 20, 2008, at 5:01 AM, ian tabangay wrote:
>>
>>  i am familiar with findList and how to use EntityConditionList and
>>> EntityExpr. But i am only familiar with comparing a column with a given
>>> value (like new EntityExpr("columnName", EntityOperator.EQUALS, value).
>>> What
>>> i wanted to do is to compare 2 columns of an entity. For example, if it
>>> were
>>> written as an SQL, it would be something like "SELECT column_a, column_b
>>> FROM table WHERE column_a = column_b"
>>>
>>> On Wed, Nov 19, 2008 at 9:17 PM, BJ Freeman <bj...@free-man.net> wrote:
>>>
>>>  do a search in code for findList
> 

Re: Comparing columns in an entity

Posted by ian tabangay <it...@gmail.com>.
That's not really very efficient especially if youre trying to find a few
items from a hundred thousand. Putting it in a list would easily give you an
OutOfMemoryException. I have a workaround for this but its done using
SQLProcessor which could be problematic later on. Any other suggestions?

On Thu, Nov 20, 2008 at 6:15 PM, Bilgin Ibryam <bi...@iguanait.com> wrote:

> One way could be
>
> values = delegator.findList("EntityName", null, null, null, null, true);
> List field1Values = EntityUtil.getFieldListFromEntityList(values, "field1",
> true);
> finalValues = delegator.findList("EntityName",
> EntityCondition.makeCondition("field2", EntityOperator.IN, field1Values),
> null, null, null, true);
>
> Bilgin
>
>
> On Nov 20, 2008, at 5:01 AM, ian tabangay wrote:
>
>  i am familiar with findList and how to use EntityConditionList and
>> EntityExpr. But i am only familiar with comparing a column with a given
>> value (like new EntityExpr("columnName", EntityOperator.EQUALS, value).
>> What
>> i wanted to do is to compare 2 columns of an entity. For example, if it
>> were
>> written as an SQL, it would be something like "SELECT column_a, column_b
>> FROM table WHERE column_a = column_b"
>>
>> On Wed, Nov 19, 2008 at 9:17 PM, BJ Freeman <bj...@free-man.net> wrote:
>>
>>  do a search in code for findList
>>>
>>
>

Re: Comparing columns in an entity

Posted by Bilgin Ibryam <bi...@iguanait.com>.
One way could be

values = delegator.findList("EntityName", null, null, null, null, true);
List field1Values = EntityUtil.getFieldListFromEntityList(values,  
"field1", true);
finalValues = delegator.findList("EntityName",  
EntityCondition.makeCondition("field2", EntityOperator.IN,  
field1Values), null, null, null, true);

Bilgin

On Nov 20, 2008, at 5:01 AM, ian tabangay wrote:

> i am familiar with findList and how to use EntityConditionList and
> EntityExpr. But i am only familiar with comparing a column with a  
> given
> value (like new EntityExpr("columnName", EntityOperator.EQUALS,  
> value). What
> i wanted to do is to compare 2 columns of an entity. For example, if  
> it were
> written as an SQL, it would be something like "SELECT column_a,  
> column_b
> FROM table WHERE column_a = column_b"
>
> On Wed, Nov 19, 2008 at 9:17 PM, BJ Freeman <bj...@free-man.net>  
> wrote:
>
>> do a search in code for findList


Re: Comparing columns in an entity

Posted by ian tabangay <it...@gmail.com>.
i am familiar with findList and how to use EntityConditionList and
EntityExpr. But i am only familiar with comparing a column with a given
value (like new EntityExpr("columnName", EntityOperator.EQUALS, value). What
i wanted to do is to compare 2 columns of an entity. For example, if it were
written as an SQL, it would be something like "SELECT column_a, column_b
FROM table WHERE column_a = column_b"

On Wed, Nov 19, 2008 at 9:17 PM, BJ Freeman <bj...@free-man.net> wrote:

> do a search in code for findList

Re: Comparing columns in an entity

Posted by BJ Freeman <bj...@free-man.net>.
do a search in code for findList

ian tabangay sent the following on 11/19/2008 3:17 AM:
> im doing this in java.
> 
> 
> On Wed, Nov 19, 2008 at 6:53 PM, BJ Freeman <bj...@free-man.net> wrote:
> 
>> are you doing this in a groovy, mini language, or a widget?
>>
> 

Gift Certificate

Posted by Florin Popa <fl...@gmail.com>.
Hello,

I am using Ofbiz revision 691692. Could anyone tell me if Gift 
Certificate is implemented in that version or maybe in a newer one?
Actually, is the service "createGiftCertificate" really used?

Any detailed description of using gift certificates would be really 
appreciated.

Best regards,
 flopa





Re: Comparing columns in an entity

Posted by ian tabangay <it...@gmail.com>.
im doing this in java.


On Wed, Nov 19, 2008 at 6:53 PM, BJ Freeman <bj...@free-man.net> wrote:

> are you doing this in a groovy, mini language, or a widget?
>

Re: Comparing columns in an entity

Posted by BJ Freeman <bj...@free-man.net>.
are you doing this in a groovy, mini language, or a widget?

ian tabangay sent the following on 11/19/2008 2:44 AM:
> Hi.
> How do you do an EntityCondition wherein you need to compare the values of
> the 2 columns within the entity?
> Thanks.
> 
> 
> ~ ian
> 

Re: Comparing columns in an entity

Posted by ian tabangay <it...@gmail.com>.
Yes that did the trick! Thanks alot Charles!


On Fri, Nov 21, 2008 at 10:14 PM, STELTZLEN Charles <
charles.steltzlen@nereide.biz> wrote:

> Hi,
>
> I'm not sure  :-\ but I think it's possible with EntityFieldsValues like
>
> new EntityExpr("originFacilityId", EntityOperator.EQUALS, new
> EntityFieldValue("facilityId"));
>
> Isn't it ?

Re: Comparing columns in an entity

Posted by STELTZLEN Charles <ch...@nereide.biz>.
Hi,

I'm not sure  :-\ but I think it's possible with EntityFieldsValues like

new EntityExpr("originFacilityId", EntityOperator.EQUALS, new
EntityFieldValue("facilityId"));

Isn't it ?

ian tabangay a écrit :
> Hi.
> How do you do an EntityCondition wherein you need to compare the values of
> the 2 columns within the entity?
> Thanks.
>
>
> ~ ian
>
>