Defining Line Action Events
Detail forms can also have actions for each detail line. This is called the line action.
Similar to the form action, which tells a program what action to perform with the form data, the line action tells a program what action to perform with the data on a detail line. A program performs a line action event as part of a form action event.
On a file-detail form, the Add Edit, Change Edit, and Delete Edit events are line action events. They are part of the Add Detail or Enable Detail form events. Add Detail and Enable Detail form events do not update records because a file-detail form does not have a header file. Rather, Add Detail and Enable Detail form events allow the line actions to update the records.
The following example shows form action events for a file-detail form that updates the Company file. The Form Action Definition window indents line action events below the form action event that performs them.
A header-detail form can update both the header file and the detail file. Therefore, a header-detail form can have Add Edit, Change Edit, and Delete Edit events for both the header file and the detail file.
A program usually performs the detail file Add Edit event as part of the header file Add Edit or Change Edit events, and it usually performs the detail file Change Edit and Delete Edit events as part of the header file Change Edit event.
The following example shows the form action events for a form whose header file is Company and whose detail file is Department.
When you create a form, the system initially sets the detail Add Edit event, part of the form Add Edit or Add Enable event, to default. This means that when you type "A" in the form action field, the form assumes that you also want to add all detail lines, whether or not you type "A" in the line action. You can change the detail Add Edit event so that it does not default on an Add form action.
When you create a detail form, the system automatically activates the Select Detail event (line action "X"). This action lets you mark a line on a detail form. When you transfer to another form, the data on the line you marked is transferred to the matching fields on the new form. For more information on form transfers, see Defining a Transfer Menu.
The Insert Detail event lets you insert up to nine blank detail lines on a detail form. The form action "X" usually indicates an Insert Detail event. A line action of 1 through 9 tells the program how many blank detail lines to insert.