05-16-2014 03:09 AM
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;
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";
05-19-2014 03:42 PM
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; acctParent.LookupPreFilters.Clear(); // create new prefilter LookupPreFilter pf = new LookupPreFilter(); pf.CondOperator = "Not Equal to"; pf.PropertyName = "AccountName"; pf.FilterValue = "'' and AccountName like '%*'"; pf.PropertyType = "String"; acctParent.LookupPreFilters.Add(pf);
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.
05-20-2014 01:35 AM