How Do I Let the End User Mark Several Records in a Table and Handle the Marked Records Collection? (Magic xpa 4.x)
Sometimes it is helpful to allow a user to select several items from a list. Magic xpa has a built-in facility to do this, in the multi mark functions.
The properties of the table have to be set up before multi-marking is available.
Now, the user can select multiple records from this table.
Once the records are selected, you need to process them. Typically this would mean writing the records out to another table for further processing, but in our example we just give the user a message.
-
Create an event that will be raised when it is time to handle the marked records. In our example, we use a push button that raises the event “ge.Start”.
-
In the handler for the event, process the record as if it were just the current record. In our example, the user will get three messages, one for each record selected. This is true even though there is no block loop involved.
-
Within the event, you can use MMStop() to exit the processing before all the marked records are handled. When MMStop() is executed, the engine will park on the record that was being processed when the MMStop() was executed.
-
You can execute code after all the records are processed by using a block with the expression
MMCurr()=MMCount(0)
MMCurr() will be the number of the record currently being processed, while MMCount(0) is the total number of records.
In our example we use this test to clear the multi marking after the last record is processed.
-
MMClear() unmarks all marked records.
The Online Samples project (program EL07)