Batches¶
A batch is (essentially) a temporary data table, which can be previewed and modified before the user “executes” it, which effectively “applies” the batch data e.g. to the live system(s).
Each batch will be of a certain batch type. Each instance of the app will have just one batch handler configured for each batch type.
Batch data may come from anywhere - CSV file, SQL query, external API etc. In some cases (e.g. creating a purchase order, or counting inventory) the data is added over time by the user. Ultimately it’s up to the handler + UI to support whatever is needed.
The user can review all data in the batch before executing. Some batches may allow the user to add/remove/modify rows (or other data) in the batch prior to execution.
Upon execution the batch handler’s
execute() method is invoked,
so that will determine what is done with the batch data. Once a batch
is executed, it is “frozen” with no further modifications allowed to
it.
Note
It’s certainly possible to use a batch to import or export data. However within the Wutta Framework, those terms tend to have a specific meaning which implies automation, whereas the point of a batch is to keep a human in the loop.
Just to minimize confusion, these batch docs will avoid any examples which mention “import” or “export” and instead focus on other ad-hoc data operations.
For more about the import/export automation see WuttaSync.
Here are some example use cases from the retail world:
POS transaction - cashier rings up items to populate batch, then finalizes w/ payment
purchase order - buyer adds items via lookup or scanner device, then submits to vendor / posts to POS backend
inventory count - staff adds items via scanner device, then posts to POS backend
pricing updates - staff makes their own spreadsheet w/ new pricing data, uploads as new batch, then posts to POS backend
label printing - often as follow-up / using a pricing update batch as data source, then post them to the printer device
That is a small set, just to give some idea. The sky is the limit!