Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Posts: 24
Registered: ‎07-15-2009

SLX 8.1 Lookup Prefilters with multiple conditions

Hi guys


I am trying to apply a prefilter on form load to filter the ISVApplication lookup by Country and worldwide (true). If I set one condition ie Wordwide = 'T' the prefilter works fine but as soon as I add in another condition no records are returned.


I have been struggling with this for a while now, any help would be greatly appreciated.


I have the following code:


Sage.Entity.Interfaces.ITPThirdPartyAssociation assoc = this.BindingSource.Current as Sage.Entity.Interfaces.ITPThirdPartyAssociation;

object parent = this.GetParentEntity();

if (parent is Sage.Entity.Interfaces.IAccount)
assoc.Account = (Sage.Entity.Interfaces.IAccount)parent;

string sCountry = assoc.Account.Address.Country.ToString();
textbox1.Text = sCountry;


Object[] myObjArray = new Object[1];

myObjArray.SetValue(assoc, 0);
ISVApplication.LookupExclusions = myObjArray;

LookupPreFilter pf = new LookupPreFilter();
pf.CondOperator = "Not Equal To";
pf.PropertyName = "Worldwide";
//pf.FilterValue = "%' AND (assoc.TPISVApplication.Countries like '%" + sCountry + "%' OR assoc.TPISVApplication.Worldwide = 'T') AND 'A' != 'B";
pf.FilterValue = "XXX' AND assoc.TPISVApplication.Worldwide = 'T' AND 'A' != 'B";
pf.PropertyType = "System.String";



Bronze Super Contributor
Posts: 152
Registered: ‎02-01-2011

Re: SLX 8.1 Lookup Prefilters with multiple conditions

I have this in my personal code repo as:


( filter account names to only those ending in *. )


// LookupExclusions must be set to invalidate cache
acctParent.LookupExclusions = new Object[0];
// create new prefilter
LookupPreFilter pf = new LookupPreFilter();
pf.CondOperator = "Not Equal to";
pf.PropertyName = "AccountName";
pf.FilterValue = "'' and AccountName like '%*'";
pf.PropertyType = "String";

 I don't know why the quotes are the way they are, as it doesn't seem to be how the injection hack is supposed to work. Maybe worth a try?


Also you can pretty much see exactly the resulting SQL in the SLXProfiler which can help you track down why you are not getting any results.

Andy Freeman
TrellisPoint, LLC
Posts: 24
Registered: ‎07-15-2009

Re: SLX 8.1 Lookup Prefilters with multiple conditions

Thanks for this, we did run the SLXProfiler and identified the issue. Basically prefilters are broken in 8.1, we can do AND statements but OR will break the statement and whole statement it is viewed as a string value because of enclosing "".

No date on fix as yet