Skip to content

Updatable BAQ grids

Kinetic

An updatable BAQ (uBAQ) lets users edit rows in a grid and save them back through the BAQ’s update logic. In Kinetic, the grid won’t wire the save up for you. You tell it which view holds the rows, which columns are editable, and what to do when the user clicks Save.

Build and test the updatable BAQ in the BAQ designer first, with its update processing and the columns you want editable. If the BAQ doesn’t save correctly on its own, nothing below will fix it.

In Data Views, add a view, e.g. XX_EditRows, with Server Schema BAQ and BAQ Id your uBAQ. This view holds the rows the grid shows and the save sends back.

Data View designer for a view named BAQView with Server Schema BAQ, a BAQ Id selected and the BAQ columns listed

  1. Drag a Panel Card Grid (or a plain grid) onto the page.

  2. In Data > Grid Model, turn on the grid’s editable option.

    Panel card grid selected in the designer with Grid Model > Editable ticked in the Properties panel

  3. In Data > Grid Model > Columns, add the columns. Field is the BAQ alias and Title is the header. Don’t touch Provider Model > Columns.

    Grid Model > Columns with a column whose Field is the BAQ field name and whose Title is the column heading

  4. On each column users should change, turn on its editable option.

    Grid Model > Columns for one column with the Editable checkbox ticked

  5. In Grid Model > Provider Model, set Ep Binding to XX_EditRows and Baq ID to your uBAQ.

    Grid Model > Provider Model with Ep Binding set to the view and Baq ID set to the BAQ

  1. Go back to the grid’s top-level properties and open Advanced > Action Data.
  2. Add a tool:
    • ID: e.g. XX_toolSaveRows. The event refers to it.
    • Text: the hover text, e.g. Save changes
    • Icon: optional, a Material Design Icons class such as mdi mdi-content-save
    • Tick Add to Primary ToolBar if it should show on the card’s toolbar

Grid Action Data with a tool whose ID, Description and Icon (mdi mdi-ghost) are filled in and Add to Primary ToolBar ticked

  1. Create an event with trigger Type Control, Hook On Click, Target XX_toolSaveRows.

    Save event canvas: a Control onClick trigger followed by two erp-baq widgets, with the trigger Type Control, Hook On Click and Target set to the save tool

  2. Add an erp-baq widget: BAQ Id your uBAQ, View Name XX_EditRows, Mode update. Under BAQ Update Options, set Operation to update. The same panel has Send All Rows and Rollback Data On Error. Test with your uBAQ to see which behavior you need.

    erp-baq BAQ Update Options with Operation update, Send All Rows ticked and Rollback Data On Error unticked

  3. On the success path, add a second erp-baq with the same BAQ and view in get mode. This reloads the grid, so users see what the server actually saved, including rows that now drop out of the query.

The finished save event: On Click trigger, erp-baq in update mode, then a second erp-baq in get mode on the same BAQ and view to refresh the grid

Save the layer and close and reopen it before previewing. Grids and views set up in the same session often don’t load data in preview until the layer has been reopened. Then edit a row, click your save tool and check the change in the database.

  • Parent/child views: if the uBAQ view has a parent/child relationship, every relationship column must be among the grid’s columns, or the save can’t match rows.
  • Nothing happens on save: check the Network tab for the update call and its response. uBAQ validation errors come back there. See Debugging.
  • Grid doesn’t show the change: you’re missing the refresh erp-baq (get) after the update.

Older releases don’t have the update mode on erp-baq. Use rest-erp to call the BAQ service directly in the save event instead:

  • Service Name Ice.BO.DynamicQuerySvc, Service Operation UpdateByID
  • Method Parameters: queryID (string) = your uBAQ ID, and queryResultDataset (object) = the name of the data view holding the edited rows, e.g. XX_EditRows
  • ERP Rest Arguments > Request Parameters: Parameter Path queryResultDataset, Parameter Name Results, View Name XX_EditRows, and under Dataset set both Dataset Id and Server Dataset Id to XX_EditRows

rest-erp widget in the save event with Service Name Ice.BO.DynamicQuerySvc and Service Operation UpdateByID

rest-erp Method Parameters with Field Name queryID, type string and the BAQ ID as the value

rest-erp ERP Rest Arguments > Request Parameters with Parameter Path queryResultDataset, Parameter Name Results and the view name

Request Parameters > Dataset with System Code ERP and the view name in both Dataset Id and Server Dataset Id

Those parameter path and name values are fixed. The call fails with anything else. Follow it with an erp-baq in get mode to refresh, as above.

Sources

This page is written in our own words. It was informed by: