Custom Restriction in Extender for multiple selection field in extra table

Hello,

We created for a customer of us a multiple selection field for a List:

In the database it is a varchar fiield:

I am trying to add the list search option to the extender.

The idea is to build a "Like" SQL restriction like this:
AND(((T1."Verpackungstechnik" LIKE @P2) OR(T1."Verpackungstechnik" LIKE @P3)))
...
,@P2=N'%|286|%',@P3=N'%|287|%'

I created a "public override bool SetRestriction" in my extender class derived from TableExtenderBase.

Unfortunately it comes to double restriction on my field:

WHERE (((T1."Verpackungstechnik" IN(@P0, @P1)) AND(((T1."Verpackungstechnik" LIKE @P2) OR(T1."Verpackungstechnik" LIKE @P3))))

The first part (standard "IN"-Check of list values) comes from the base class.
If I deactivate the call
bool retVal = base.SetRestriction(_restrictions);

I get a wrong query (multiplicated):
... FROM crm7."SP_FLIESEINFO" T13, crm7."CONTACT" T0 RIGHT OUTER JOIN crm7."PERSON"

 

I tried to filter the restriction of the base class call:


bool retVal = base.SetRestriction(_restrictions.Where(x=>x.Name != m_ProviderName + "/IncotermsList" && x.Name != m_ProviderName + "/VerpackungstechnikList").ToArray());

Then I get server error 500.

 

How can I build a restriction instead of standard one for this field?

Thank you in advance!

Andrey

 

 

 

RE: Custom Restriction in Extender for multiple selection field in extra table

I managed to make it work. The trick is to replace each restriction of multiselection fields with a restriction returning true, report it to base class and to build new one for the custom field:

Andrey

By: Andrey Stupak 4 Nov 2020