Altova MobileTogether Designer

The Edit Offices table has been created on a separate top page. When the solution runs, this page is accessed from the main page (screenshot below left). Clicking the button Edit Offices Table loads the Edit Offices table (screenshot below right).  The Offices table has seven rows, each of which has a non-editable ID column, an editable City column, and a Delete control (see screenshot below right). Additionally, there is an Append Row control below the last row, a Submit button in the Edit Offices Table bar, and a Back button to go back to the previous page (the main page in this case).

MTDDBCSimulator01   MTDDBCSimulatorEditOffices01

In the design, the Edit buttons (first screenshot below) have both been assigned the Go to Page action on their respective OnButtonClicked events (right-click the button and select Control Actions for OnButtonClicked). These Go to Page actions (second screenshot below) load the respective target pages.

MTDDBCEditButtons
MTDDBCOnButtonClickedOffice

 

Creating the editable Offices table

The Offices table in the DB has the structure displayed in the data tree of $DB1 (screenshot below). Since the @id attribute is the primary key, it cannot be changed. This means that when a new record is appended, the end user cannot enter an @id value via the solution. The @id value must be generated automatically using an XQuery expression. The XQuery expression is inserted by using the context menu command, Ensure Exists before Page Load (XPath Value):

 

let $all := $DB1/DB/RowSet/Row/@id

let $ids := remove($all, index-of($all, ""))

let $id := if (empty($ids)) then 1 else max($ids) + 1

return $id

MTDDBCDataSrcDB1

In the design, we will do the following:

 

To...

How

Display all (Office) rows

Add a repeating table, with the Office row as the repeating element

Include controls for deletion and addition of rows

When adding the table, enable the automatic inclusion of Delete/Append controls

Enable editing of @City values

Add an Edit Field control that has a source node to @City

Save changes back to DB

Add a Save action to the page's OnSubmitButtonClicked event;

Also, right-click $DB1 and toggle on Create OriginalRowSet

Go back to the main page

Add a Go to Page action to the page's OnBackButtonClicked event

 

 

 

© 2017-2023 Altova GmbH