Creating a fixed number of related records

On an entry screen, I have 5 global fields, one of which is a quantity, 2 of which are date fields and the remaining two are text. After this is entered, the method will run a check and if the check is positive will create a new record in the master file waiting for the user to enter some additional information. Once that is done, pressing the Submit button will create a related record for the remainder of the information to be entered.

What I want to achieve is only allow the same number of related records to be created as are in the quantity field. For example, if the number is 2, then only 2 related records can be allowed to be created.

Ideally what I would like to see happen is the related records, whether that be 1,2, 3, etc be created and then displayed using Show Form as Dialog. Is that possible. TIA.

Sure, while creating the records throw the id’s in an array.

Convert that array into a foundset and load that foundset into the form before opening it as a dialog.

Thanks, Marcel.

Would you have an example of the code for this? TIA.

No, I would have to build that and btw your learning curve is much better if you try to do this yourself :)

Look at

//Converts the argument to a JSDataSet with one column that can be used in controller.loadRecords(pkdataset)
databaseManager.convertToDataSet(Object array/ids_string)

Thanks.