Entity Filter with "or" or "AND" out of an variable
Application Type
Reactive
Service Studio Version
11.10.10 (Build 38777)

Dear Community,

I am looking for a smart way to solve following search problem.

I know  I could just duplicate everything in the entity filter but there will be
more fields to be added for searched.

I want to search the first searchfield and/or the second searchfield depending on the Buttongroup setting.
I am passing the values in OrAndSel as "OR" or "AND".

Could not find anything yet, even tried SQL. 

Thanks in advance,

Guenter

Solution

Hi Guenter,

Without Advanced SQL, the only way I could think of was using duplicate filters like:

(OrAndSel = "OR" and (... OR ...))
or
(OrAndSel = "AND" and (... AND ...))

Best regards

mvp_badge
MVP
Solution

Hello Guenter.

The only way I can think of is Advanced SQL and expand inline, so not valid for client actions...

To make the string shorter you can save each branch as a Calculated Attribute and then write the long query with only Branch1 and Branch2... Is it enough for you?

Solution

Hi Guenter,

Without Advanced SQL, the only way I could think of was using duplicate filters like:

(OrAndSel = "OR" and (... OR ...))
or
(OrAndSel = "AND" and (... AND ...))

Best regards

Dear Nuno and Kadu, thank you for your replies.

I did the duplication, as been afraif to do so, and got it to work.
(Unfortunatly the brackets are placed mostly automatically.)

Nuno's tip to  with Calculated Attributes  improves to overview a lot.

Calculated Attribut Example : OrResult
-------------------------------------------
(OrAndSel="OR" and 
    (
        (Src1 <> "" and ((CnW.Description like "%" + Src1 + "%") or (CnW.Comment like "%" + Src1 + "%"))) 
        or
        (Src2 <> "" and ((CnW.Description like "%" + Src2+ "%") or (CnW.Comment like "%" + Src2 + "%"
)
    ))))

Put the lines as 2x Calculated Attributes the final filter looks like


(OrAndSel="OR" and OrResult)
or
(OrAndSel="AND" and AndResult)

Thank you both, I did learn a lot.

Guenter

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.