Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, August 18, 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 and binding primary key and string values
Andrew Sokolsky
Posts: 26
 
Lookup and binding primary key and string valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Mar 09 1:39 PM
I have a lookup that I want to bind the string resulting value to a text text field and it's corresponding primary id to an id field. I already have the "lookup resulting value" bound to the text field. How do get the primarykey to bind to the id field I have created?
[Reply][Quote]
David Lumm
Posts: 87
 
Re: Lookup and binding primary key and string valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Mar 09 4:21 AM
Hi Andrew

You'll have to forgive me, I'm still a bit of a novice to this too, but I reckon the best way would be to change the Lookup to return the primary key and then change the binding to your ID field.

Next set an onChange event for the Lookup. Using the resultant ID get the Text that you want and insert that into the field you want.

Note: It is best to set your result into the entity property, rather than a control, as this is less prone to problems.

If you need any further help with this post a reply and I'll help if I can - but I'm sure one of the other SLX masters will be able to help!

David
[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: Lookup and binding primary key and string valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Mar 09 4:18 PM
Andrew,
Here's how I'd go about it:

- Make a lookup that's a button only
- Be sure that the Lookup Biding Mode (about 1/2 way down in the properties window) is set to 'Object'
- In the on change event of the lookup, bind to the entity and then assign values as you see fit. For example:
Sage.Entity.Interfaces.IMyEntity me = lueLookup.LookupResultValue as Sage.Entity.Interfaces.IMyEntity;

Now, you can get all fields in the entity you just returned using standard entity properties (me.Id, me.MyField, etc...)

I've used this technique before for various reasons. If you want it to look right, you may want to put one of the text fields in a control container next to the lookup control. This makes it appear as a stock lookup to the user.

Mike LaSpina
[Reply][Quote]
Andrew Sokolsky
Posts: 26
 
Re: Lookup and binding primary key and string valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Mar 09 1:34 AM
Thanks guys. I will try these methods out tomorrow and let you know how it goes.

-Andrew
[Reply][Quote]
Ken Poggensee
Posts: 71
 
Re: Lookup and binding primary key and string valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Mar 09 3:35 PM
I have a similar issue where my lookup is to filter a grid based on what is selected. I have a business rule that uses GetByMethod to return an IList that is tied to the grid, but this only works if I open a form that has that lookup value already populated.

So how do I do something similar to your example to refresh\reset the datasource or whatever I need to do to make the grid refresh with the item selected in the lookup?
“Sage.Entity.Interfaces.IMyEntity me = lueLookup.LookupResultValue as Sage.Entity.Interfaces.IMyEntity;”


Btw when I try something like this on the change actions of the lookup it blows up on creating the repository. This came from my business rule that works for existing records. No I also need it dynamically filter the grid at runtime.
--------------
IRepository repository = EntityFactory.GetRepository();
IQueryable qry = (IQueryable)repository;
IExpressionFactory ef = qry.GetExpressionFactory();
ICriteria criteria = qry.CreateCriteria();
criteria.Add(ef.Eq("Templateheaderid", bidspec.Template.ToString()));
result = criteria.List();
[Reply][Quote]
Andrew Sokolsky
Posts: 26
 
Re: Lookup and binding primary key and string valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Mar 09 7:29 PM
Ken & Co.

Got it to work! Thanks for everyone's help!

Here was my final solution (On Change Action: C# Snippet Action Item):

Sage.Entity.Interfaces.ICAccountAgencyLink CAccountAgencyLink = this.BindingSource.Current as Sage.Entity.Interfaces.ICAccountAgencyLink;

Sage.Entity.Interfaces.IContact contact = lkpAgencyContact.LookupResultValue as Sage.Entity.Interfaces.IContact;

CAccountAgencyLink.AgencyContactID = contact.Id.ToString();
CAccountAgencyLink.AgencyContact = contact.FullName;

[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): 8/18/2025 7:51:05 PM