Help with lookup values


Author
Message
Sam Garvin
Sam Garvin
StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)
Group: Forum Members
Posts: 10, Visits: 37
Hi

I've been checking the forum and I have found some posts regarding the use of lookup values and now I'm a little bit confused.

I have a maintenance form with some textboxes binded to the fields in BO1, I can navigate, edit, add, delete, etc. and  I've also created a second BO (BO2) and a combobox binded to it and I can see all the descriptions from the table associated to BO2.

What would be the best approach to display the corresponding description (from BO2) instead of displaying the ID value from BO1? I've read about parentrelationship property, about creating a custom property in the BO1 and retrieve the value from table2 in the Fill method in BO1, etc., but so far nothing is working w00t

Any help or advice pointing me in the right direction would be very appreciated.

Thank you very much for your time.

Replies
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Sam,

If you want to show the description in a ListView, you could use a Custom Field Property whit all the binding description so you can use it as a regular field in your list view.  There are a lot of samples in the forum just search for Custom Field Property.

If you are using a combobox to show the lookup data, just define the description field in the lookup to be shown instead of the FK field.  Also you don't need to have a lookup BO for the combobox in the form, just setup the combobox to call a method in your base BO so it will be populated.  The combobox and the listview use an internal BO to get their data and them discard that internal BO.  If for whatever reason you want to have a Lookup BO in the form, then make sure you populate it with the correct data, and use the CopyData method to populate the internal combobox/listview BO.  Check the help file for a better explanation and also search the forums to find many sample code to do this.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Edhy is going down the right path with the custom property if you are going to be binding to a foreign key value from another table.  If you have a foreign key value and want to show the description or title from that table, then you will more than likely just want to create a custom property that calls a scalar method that retrieves the description for display purposes.  Another option would be to create a combo box and use the PopulationDataSource settings.  This is geard for this very thing when dealing with smaller lookup table datasets (200 records or less).  You can create a Fill method on the Foreign Key table BO that just pulls back the PK and the description columns.  Then use an SF combo and populate using a BusinessObject.  You will set the PopulationDataSourceSettings to use the BO of the foreign key value, the Fill method you created to pull back just the PK and the description column, and then set the Display Member to show the description and the Value Member to the foreign key field.  This will setup the very scenario that you are trying to accomplish.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search