Forums de discussion
Error in building service with arrayable-operator="OR" in liferay 6.2
Fahad v, modifié il y a 9 années.
Error in building service with arrayable-operator="OR" in liferay 6.2
Junior Member Publications: 35 Date d'inscription: 14/07/14 Publications récentes
Hi,
I need to build a finder to search contact name by first and last
The Query should be
i wrote the finder as shown below
But i can see in
as
why the query is build with "AND" not with "OR"
Please Help
im using Liferay 6.2 Version
I need to build a finder to search contact name by first and last
The Query should be
fname like 'a' or lname like 'a'
i wrote the finder as shown below
<finder name="ContactName" return-type="Collection" unique="false">
<finder-column name="firstName" case-sensitive="false" comparator="LIKE" arrayable-operator="OR"></finder-column>
<finder-column name="lastName" case-sensitive="false" comparator="LIKE" arrayable-operator="OR"></finder-column>
</finder>
But i can see in
*Persistence.findByContactName (keyword, keyword);
as
Returns all the contacts where firstName LIKE ? and lastName LIKE ?.
why the query is build with "AND" not with "OR"
Please Help
im using Liferay 6.2 Version
Nagendra Kumar Busam, modifié il y a 9 années.
RE: Error in building service with arrayable-operator="OR" in liferay 6.2
Liferay Master Publications: 678 Date d'inscription: 07/07/09 Publications récentes
AFAIK, when you declare two finder columns under a finder - it makes that columns ANDed not ORed. Probably better approach in this case for you is custom sql query
https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/develop-custom-sql-queries-liferay-portal-6-2-dev-guide-04-en
https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/develop-custom-sql-queries-liferay-portal-6-2-dev-guide-04-en
Fahad v, modifié il y a 9 années.
RE: Error in building service with arrayable-operator="OR" in liferay 6.2
Junior Member Publications: 35 Date d'inscription: 14/07/14 Publications récentes
Then the arrayable-operator attribute is of no use
<finder-column name="lastName" case-sensitive="false" comparator="LIKE" arrayable-operator="OR"></finder-column>
Nagendra Kumar Busam, modifié il y a 9 années.
R: Error in building service with arrayable-operator="OR" in liferay 6.2
Liferay Master Publications: 678 Date d'inscription: 07/07/09 Publications récentes
In your case, yes. It is useful if you what to do multiple values checking within the same column - based on operator provided it works differently
Sent from my iPhone with Liferay.com Forums
Sent from my iPhone with Liferay.com Forums
Fahad v, modifié il y a 9 années.
RE: Error in building service with arrayable-operator="OR" in liferay 6.2
Junior Member Publications: 35 Date d'inscription: 14/07/14 Publications récentes
Thanks Nagendra Kumar
I used the custom query to retrieve the data with or condition
I used the custom query to retrieve the data with or condition