Comparing columns in an entity

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

Comparing columns in an entity

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


~ ian
Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

BJ Freeman
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
>
Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

ian tabangay
im doing this in java.


On Wed, Nov 19, 2008 at 6:53 PM, BJ Freeman <[hidden email]> wrote:

> are you doing this in a groovy, mini language, or a widget?
>
Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

BJ Freeman
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 <[hidden email]> wrote:
>
>> are you doing this in a groovy, mini language, or a widget?
>>
>
Reply | Threaded
Open this post in threaded view
|

Gift Certificate

Florin Popa
In reply to this post by ian tabangay
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




Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

ian tabangay
In reply to this post by BJ Freeman
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 <[hidden email]> wrote:

> do a search in code for findList
Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

Bilgin Ibryam
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 <[hidden email]>  
> wrote:
>
>> do a search in code for findList

Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

ian tabangay
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 <[hidden email]> 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 <[hidden email]> wrote:
>>
>>  do a search in code for findList
>>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

Malin Nicolas
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 <[hidden email]> 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 <[hidden email]> 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/

Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

BJ Freeman
In reply to this post by ian tabangay
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 <[hidden email]> 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 <[hidden email]> wrote:
>>>
>>>  do a search in code for findList
>
Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

ian tabangay
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 <[hidden email]> 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.
>
Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

BJ Freeman
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 <[hidden email]> 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.
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

ian tabangay
I see. thanks.

On Fri, Nov 21, 2008 at 6:06 PM, BJ Freeman <[hidden email]> wrote:

> Hopefully the people that have done the refactoring will respond.
> I have never run across the requirement myself.
> even in SQL.
Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

STELTZLEN Charles
In reply to this post by ian tabangay
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
>
>  



Reply | Threaded
Open this post in threaded view
|

Re: Comparing columns in an entity

ian tabangay
Yes that did the trick! Thanks alot Charles!


On Fri, Nov 21, 2008 at 10:14 PM, STELTZLEN Charles <
[hidden email]> 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 ?