Using Subroutines with Grids
This form is accessed directly from the Flow Step form where you build your grids.
Alternatively it can be accessed rom Application Control - VB Provider - VB Provider Button Mapping and looks like this. When accessed in this way t is necessary to select the option Map to specific Function Area and then to select the Function Area you will be working with as shown below. This is automoated when accessed the form from the Flow Step Maintenance form.
Selection required for SR mapping
It is then necessary to select the option Subroutine to be presented with a list of Subroutines that have been built. After that simply selected which button you want to call the subroutine from and click on Map
Selecting a SR and Button to Map
If the subroutine has no parameters defined then this is all that is required. However that probably won't happen very often. Most commonly a subroutine is required to act of the data in the grid whether it is printing a label, posting to Syspro or updating a process status. In all of these scenarios the subroutine will have to be told something about the selected rows. This is done by passing parameters to the subroutine. The most common parameter to pass is the ID of the selected row but if for example you are editing data directly in the grid, the values of all modifiable columns can be passed to the subroutine. If there are parameters defined then the form below will open
SR Parameter mapping
In the example above, the ID of the selected row was mapped to the SR. The subroutine was build using a single parameter called SelectedRowID as shown below
Subroutine definition
In an example such as this, the ID of the selected row/s are passed and the subroutine will be executed once for each row ID. This is an ideal way to allow users to add or edit data without editing data in the grid directly. There is also an extension to this to allows for cases where you do not want to run through the entire subroutine for each row that is selected. Say for example you want to print Bin Labels for all selected Bin Locations on a grid. You may want to ask the user which printer to print to and how many labels to print but you would like those responses to apply to all selected rows and not need the user to enter a response for each label to print. In this case you use the repeating step logic highlighted above. When building the function you would have say three steps. Select Printer, Enter Number of copies, Print Labels. You would select that only the print labels step should repeat, all the other steps should be executed once only. The step selected as the repeating step is the first step that will repeat. All steps before this one will be executed once only and all steps after this one will be repeated.
It is also possible however to have users edit data directly in the grid and pass all or some of the grid columns to the Subroutine. In this example the Subroutine was created with 3 parameters and 3 grid columns were passed to the SubRoutine. This is a very useful approach when you require users to edit data in the grid.
Mapping Multiple Parameters to a Subroutine