Q: How do I get grids to show me data from the parent record instead of the foreign key?
A: Related Business Objects, Combos in the grid or use a view.
You can do a variety of things, here are some:
- Add the cursor for the lookup table into the parent's data environment and then set the relationship using a relation object. This will make the child descriptive fields availabled for the grid used on the list page
- Open the ParentDataEnvironment
- Use the icon that looks like library books to add the acursor.vcx to your toolbar.
- Drop the child cursor class onto the parent dataenvironment
- Put the idata.vcx ( from iLibs) onto the toolbar
- drop an iRelation class onto the data environment.
- Run the builder on the relation class ( right click on object with slanted line) and set the relationship between the parent and child
- Return to parent list page in parentpresobjform and run the builder on the grid. You will see that the child descriptive field is now one of the fields available. Use that instead of the parent's foreign key
- Use a combo box in the grid. The easy way to do this is: You probably already did this. Use the grid builder and check the "Use Data Dictionary Interface Class for Controls in the grid" on the "Select Fields" dialog. In the DBCX explorer, set the "Interface class" to icombo for the foreign key field, and all of the lookup stuff on the "validation" tab. That will get the parent value in a combo box for the current row, raw key value for all others. Set the Sparse property of the column to .f. to get all of the rows to use the combo. Kinda ugly.
- Use a view that joins with the parent so that you can display the parent values in the grid.
Category Visual FoxExpress Tips And Tricks
( Topic last updated: 1999.08.24 07:25:49 PM )