Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, June 27, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: lookup prefilters
chez
Posts: 44
 
lookup prefiltersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Aug 12 11:08 AM
fiogf49gjkf0d

Hi


i have a lookup to a view, which returns data in columns


if i add prefilter via property i.e. warehouse=BB it works


but i need the warehouse to equal a value from a field i.e. txtWH.Text


so on the onload event tried:


 


lkpProduct.LookupPreFilters.Clear();


    Sage.SalesLogix.HighLevelTypes.LookupPreFilter filter = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter();


    filter.LookupEntityName = "Dclprodservices";


    filter.PropertyName = "Warehousecode";


    filter.CondOperator = "Equal";


    filter.PropertyType = "System.String";


    //filter.FilterValue = "'" + txtWH.Text+"'";


    filter.FilterValue = "'BB'";  


    //filter.FilterValue = "string.Format('{0}',txtWh.Text)";


    lkpProduct.LookupPreFilters.Add(filter);


    lkpProduct.InitializeLookup = true;


or 


    Sage.SalesLogix.Web.Controls.Lookup.LookupControl l = new Sage.SalesLogix.Web.Controls.Lookup.LookupControl();


    l = (Sage.SalesLogix.Web.Controls.Lookup.LookupControl)lkpProduct;


    l.LookupExclusions = new string[] { string.Empty };


    l.LookupPreFilters.Clear();


    Sage.SalesLogix.HighLevelTypes.LookupPreFilter lookupFilter = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter();


    lookupFilter.CondOperator = "Equals";


    lookupFilter.FilterValue = "'BB'";


    lookupFilter.LookupEntityName = "Sage.Entity.Interfaces.Dclprodservices";


    lookupFilter.PropertyName = "Warehousecode";


    lookupFilter.PropertyType = "System.string";


    l.LookupPreFilters.Add(lookupFilter);


    l.InitializeLookup = true;


 


hardcoding it to BB for now but doesn’t filter by BB and brings no data back at all(yes have warehouses=BB!)


can anyone help please - pulling hair out at mo...


 


also rather than hardcode if wanted field value inside the property section of AA is it filtervalue ="'" + txtWH.Text+"'"  ??


ta

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: lookup prefiltersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Aug 12 3:39 PM
fiogf49gjkf0d

What are you running this script from (Business Rule? Event Handler? C# Code Snippet Obsolete? and how are you obtaining your handle to the form controls to get their values?


 


http://customerfx.com/pages/integrationblog/2009/11/18/dynamically-restricting-saleslogix-lookups-controls-using-the-seedproperty.aspx

[Reply][Quote]
chez
Posts: 44
 
Re: lookup prefiltersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Aug 12 2:56 AM
fiogf49gjkf0d

am running from the onload event - so it a snippet c#code obsolete


then refer to field txtWH.Text

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: lookup prefiltersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Aug 12 8:49 AM
fiogf49gjkf0d

And you read the article?

[Reply][Quote]
chez
Posts: 44
 
Re: lookup prefiltersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Aug 12 8:55 AM
fiogf49gjkf0d

read all bits i can find in forums?


  on load the first part now works but adding a second filter doesn't??


lkpCreditNoteNo.LookupPreFilters.Clear();


 


 




 


LookupPreFilter pf = new LookupPreFilter ();





 



 



 



pf.CondOperator = "Starts With"


;




 


pf.OperatorCode = "%xx";

 





pf.PropertyName =


"Ordernumber";


 


 pf.FilterValue = "00826%" ;





//pf.FilterValue = "'%26%' and CustomerCode = '" + ret.Account.OSCustomerCode + "'";

 







pf.PropertyType =


"System.string";



 



lkpCreditNoteNo.LookupPreFilters.Add(pf);


 




LookupPreFilter pf2 = new LookupPreFilter



();



 



pf2.CondOperator = "Equal To"


;


 

 



pf2.OperatorCode = "="


;


 

 



pf2.PropertyName = "Customercode"


;


 

 



pf2.FilterValue = "DE001"


;


 

 


 


//pf2.FilterValue = ret.Account.OSCustomerCode;





pf2.PropertyType =


"System.String"; 


 


 


//pf.LookupEntityName = "Sage.Entity.Interfaces.IDclsoheader"





lkpCreditNoteNo.LookupPreFilters.Add(pf2);


 



 


 

[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: lookup prefiltersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Aug 12 3:46 PM
fiogf49gjkf0d

Use the following techniqe to inject HQL directly into your lookup.  I find that I need these a lot when I need multiple conditions.  The following example shows all contacts for a given Account or Account's Parent:


 


    // Inject HQL into a lookup filter:
string sAcctList = string.Empty;
    string sId = 'MY ID Here'; // account ID to search for


    // Note that the filter builds out the value as the following string "Account.Id != '<value in sAccount List variable>'"
    //  So, we need to make sure we account for our HQL being inside of single quotes - thus the unmatched single quotes
    //  around "xxx" at the beginning and "B" at the end.  The resulting HQL executed from the lookup will be:
    //   "Where Account.Id != 'xxx' AND (Contact.Account.Id = 'MY ID Here' OR Contact.Account.ParentId = 'MY ID Here') AND 'A' != 'B'"

    sAcctList = "xxx' AND (Contact.Account.Id = '" + sId + "' OR Contact.Account.ParentId = '" + sId + "') AND 'A' != 'B";

    Sage.SalesLogix.HighLevelTypes.LookupPreFilter actfilter = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter();
    actfilter.LookupEntityName = "Sage.Entity.Interfaces.IContact";
    actfilter.FilterValue = sAcctList;
    actfilter.PropertyName = "Id";
    actfilter.OperatorCode = "!=";
    actfilter.PropertyType = "System.String";
    lupContact.LookupPreFilters.Clear();
    lupContact.LookupPreFilters.Add(actfilter);
    lupContact.LookupExclusions = new string[] { string.Empty };

 


In your case, you could just set the filtervalue to your warehouse value and the operator to '=='

[Reply][Quote]
chez
Posts: 44
 
Re: lookup prefiltersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Aug 12 2:46 AM
fiogf49gjkf0d

 


 


 


 


 


 


 


 


 


 


 



Hi


 thanks for that, got it working with below code but the cache not refreshing so same account although puts in corrects values the lookup dialog showing old values? anyone know how to refresh the cache of the lookup dialog on the onload event?


?thanks in advance...


lkpCreditNoteNo.LookupPreFilters.Clear();


LookupPreFilter  pf = new LookupPreFilter();
pf.CondOperator = "Starts With";
pf.OperatorCode = "%xx";
pf.PropertyName = "Ordernumber";
pf.FilterValue = "00826%";
pf.PropertyType = "System.string";
lkpCreditNoteNo.LookupPreFilters.Add(pf);


LookupPreFilter pf2 = new LookupPreFilter();
pf2.CondOperator = "Equal to";
pf2.OperatorCode = "=";
pf2.PropertyName = "Customercode";
//pf2.FilterValue = "DE001";
pf2.FilterValue = ret.Account.OSCustomerCode;
pf2.PropertyType ="System.String";
lkpCreditNoteNo.LookupPreFilters.Add(pf2);


//refresh cache





 



[Reply][Quote]
chez
Posts: 44
 
Re: lookup prefiltersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Aug 12 3:22 AM
fiogf49gjkf0d

hi


resolved cache putting exclusion in solved problem



lkpCreditNoteNo.LookupPreFilters.Clear();


lkpCreditNoteNo.LookupExclusions = new string[] { string.Empty };


?thanks guys


[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: lookup prefiltersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Aug 12 11:42 AM
fiogf49gjkf0d

Yep - you have to clear the old filters out and then set the LookupExclusions at the end in order to flush everything out and cause the lookup to refresh properly.

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/27/2025 5:57:31 PM