The Child Table ListView control displays an embedded ListView control for child records related to the current record.
The embedded ListView can be mixed with other DBW controls, placed on its own page, or within other DBW controls on the same page.
You can set the embedded ListView height to zero in which case it will attempt to size itself to its parent; either a tab page or single window. You can add TextBox controls before the Table ListView control when the size is zero.
Select the appropriate table relationship and the fields displayed are from the child table of the selected table relationship.
You can specify a minimum/maximum number of required records if appropriate.
See also Common ListView Configuration.
The example below shows two Child Table ListView controls on the CUSTOMER DBW. One for ADDRESS records and one for CONTACTS records. The CONTACTS Child Table ListView control shows a subset of the columns from the CONTACTS table.
Using Dynamic Lookups in Child Table ListViews
This example shows you how to store ink colours and ink related data for each DRAWINGS record, using many-to-many table relationships.
First create an INK table:-
A DBW should be created automatically, so create some appropriate INK records.
Next, create a DRAWINK table containing the foreign keys and extra columns. We are going to store a percentage and some notes with each INK associated with a DRAWING. Note that this information is unique for each DRAWING.
Create the required table relationships:-
DRAWINK.DI_DRAWKEY->DRAWINGS.D_KEY
DRAWINK.DI_INKKEY->INK.IC_KEY
Edit your DRAWINGS DBW to add a Child Table ListView for the Ink colours.
When you add the Child Table ListView choose the DRAWINK.DI_DRAWKEY->DRAWINGS.D_KEY relationship and the fields should be populated, including a column for the DRAWINK.DI_INKKEY->INK.IC_KEY relationship.
We have put minimum/maximum record counts to ensure users create at least one ink row.
You can see the IC_NAME column has been used for the dynamic lookup because it is the first non-key field in the table. You can edit the field and change the caption and display column if you like (for instance, if you wanted to show the IC_DESC column in the combo instead).
You can also add additional static lookup columns into the field list. For instance, if you wanted to also show the IC_DESC column when the user chooses an ink in the field list.
Add a new field; only tables/columns from configured table relationships are shown. Set a caption and choose IC_DESC to add it to the field list. Ensure that IC_DESC is positioned after IC_NAME in the field list; IC_NAME is the dynamic lookup combo, while IC_DESC is the static lookup.
You cannot currently add picture columns as static lookups.
So here are the final Child Table ListView fields, with appropriate column captions.
Run the DBW in Test mode and you can see how the Ink Child Table ListView will work.
The list is initially blank.
- Add an Ink by using the Add button
- Use the Ink Colour combo to select the appropriate Ink; the Ink Description is automatically updated to reflect your choice
- Enter an Ink Percent and Notes as appropriate
When using the DBW for a project:-
- You must create at least one DRAWINK record due to the minimum/maximum constraints.
- The DRAWINK.DI_INKKEY column is a required field; you cannot save the DBW until you have selected an appropriate INK record for each row.