Hybris/ SAP commerce Cloud Flexi search query

 Hybris flexi Search Query Sample:

1. Find Duplicate Product:

select  {code},count({code}) from {product} group by {code} having count({code}) > 1 


2. B2BUnit/Group belongs to User


select distinct {unit.uid},{unit.name},{ct.uid} from { PrincipalGroupRelation as pgrel

join b2bunit as unit on {unit.pk}={pgrel.target}

Join B2Bcustomer as ct ON {ct.pk}={pgrel.source} }

where {pgrel.source} in ({{ select {pk} from {b2bcustomer} where {uid}='example@gmail.com' }})


3.User Belongs to B2Bunit


select distinct {bcustomer.uid} from {

B2BCustomer as bcustomer} where {bcustomer.pk} IN ({{

select distinct {ppgrprel.source} from {b2bunit as unit

JOIN PrincipalGroupRelation as ppgrprel ON {unit:PK}= {ppgrprel:target} }

where {unit.uid}='123456859_PARENT' }})



4.User Belongs to Group


select distinct top 10 {bcustomer.uid} from {

B2BCustomer as bcustomer} where {bcustomer.pk} IN ({{

select distinct {ppgrprel.source} from {Usergroup as grp JOIN PrincipalGroupRelation as ppgrprel ON {grp:PK}= {ppgrprel:target} } where {grp.uid}='b2basagentgroup' }})

5. All Child B2Bunit for Parent unit

select distinct {childUnit.uid} from {
b2bunit as childUnit} where {childUnit.pk} IN ({{
select distinct {ppgrprel.source} from {b2bunit as unit JOIN PrincipalGroupRelation as ppgrprel ON {unit:PK}= {ppgrprel:target} } where {unit.uid}='AMAZON_1001_UD_PARENT' }})


Comments

  1. This blog provided brief knowledge about the Hybris/ SAP commerce Cloud Flexi search query. It will help us in developing new search queries!

    ReplyDelete

Post a Comment

Popular posts from this blog

Hybris / SAP Commerce Cloud Groovy Scripting Job to Generate CSV/Excel Reports and copy to Commerce cloud Blob Storage

Emma's dream - a kids story - By Kavya

Hybris/ SAP commerce Cloud: Retry failed/not sent emails due to SMTP connection issue.