|"Priming" a Delete Dialog in Design Mode|
As noted in "Structure-Only Copy of Collection," one method of deleting all records from a Collection is to create a Template with linked Subforms. This method may also be used to delete selected records from a Collection.
The quick and comprehensive way to delete related Customer recorrds in multiple Relations is to create a View, which displays this information, from which you can delete the records. Build a Subform in each of the Relations from which you want to delete records. Draw a Repeat rectangle on the Subform.
Since the records do not need to be displayed in order to be deleted, the Repeat rectangle does not need to contain any Data rectangles. Shrink the area outside the Repeat rectangle and then adjust Template size to make it selectable on a Host form as a Subform.
To save yourself time and effort, you can copy this Template's icon and then paste it into each of the Relations where you'll be deleting records. Be sure to rename each copy to facilitate linking it on the Host View later.
Create a Host Template in the main Relation where the Customer's name and record number are stored. Place a Key Field such as "Company Name" on the Host Form so you can later find the Customer you wish to delete. Place the Subforms on this Host form.
Create a View for the Host form. Under Show Selection, attach the Subforms with their appropriate links, such as "Customer Nº."
Query on the Host form ("Delete Customer") to find the customer you wish to delete.
Choose Delete from the View menu (or type Shift-Command-D). In Design Mode, Helix RADE will ask you to select the Relations from which you want to delete the customer's records; in User Mode, Helix applications will "remember" these Relations only delete those you specified in Design Mode.
There are instances where you want control over these deletions, especially where you may have included Subforms on the Host from Global relations where you don't want data deleted. It is a good practice to enter a bunch of meaningless data in Design Mode and then set up this dialog, because you must actually run it to make the settings work; i.e., you must actually delete some records with the settings you make in Design Mode to effectively "prime" the Delete dialog.