Login  Register

Re: concatenation support in entity engine

Posted by Leon Torres-2 on Sep 19, 2006; 2:29am
URL: http://ofbiz.116.s1.nabble.com/concatenation-support-in-entity-engine-tp172516p172518.html

Hey,

I found that simple concatenate works with complex-alias.  However my problem is
more than complex-alias can handle.  The query in postgresql is as follows,

select coalesce(pg.group_name,'') || ' ' || coalesce(per.first_name,'') || ' '
|| coalesce(per.last_name,'') from party p left outer join party_group pg on
(p.party_id = pg.party_id) left outer join person per on (p.party_id =
per.party_id);

I can't see how to concatenate spaces and include the coalesce function.  I
guess I'm stuck with using an EntityListIterator and doing the matching by hand
in java.  It should work ok for now until the search space becomes huge, in
which case I'm going to need to do the coalesce SQL with an index.

Basically, this limits the ability to do on the fly searches of several fields
of data at once.  It's important for autocomplete functionality, especially when
searching for parties (and hopefully only parties), but it is not critical.

- Leon



David E Jones wrote:

>
> Leon,
>
> Have you tried a view-entity (or DynamicViewEntity) with a complex-alias?
>
> -David
>
>
> On Sep 16, 2006, at 12:23 PM, Leon Torres wrote:
>
>> Hi folks,
>>
>> Is there a way to do concatenation using entity engine?  If not, how
>> hard would it be to implement?  Maybe I can take a shot at it.
>>
>> I'm researching the options for doing searches on several string
>> fields and the only practical way I can solve the problem is to
>> concatenate the fields in a defined order and do a LIKE match.  This
>> is the only search space that seems to work for the intended feature:  
>> To allow a search on firstName + lastName so that if the user types in
>> "Leon Tor", the result set conains "Leon Tor%" and not "Leon Alpha" or
>> any results where lastName doesn't start with "Tor".
>>
>> - Leon
>
>