Complex Table Change And Complex Table Add Transactions
Hope this document may be helpful……
This document describes a simple example to update an existing record in complex table through ‘Complex Table Change Transaction’ and also how to add a record to the complex table through ‘Add Transaction’.
Complex Table Edit Transaction:
Define an object definition named Complex.Add the properties to the defined Complex object and specify the key property as Product ID.
1. Add the transaction named ‘Complex Table Change’ to the Complex Object.
2. Specify the key property as Product ID for the transaction.
1. Define an SQL Step named ‘Update Complex Table’ ,write the code to update the fields based on the Product ID.
2. Map the defined Update Step to Server Update Steps of the defined complex table transaction with ‘Response To Client ‘ attribute set as ‘Replace Client Object’.
1. Design a screen set for complex table transaction.Define a transaction screen containing following properties.
2. Make the Product ID field edit type as ‘Complex table Search’ and save.Specify the Complex table Products .
3. Select the Product Name field in the transaction screen and specify the update rule as follows by selecting browse.
:>Current Screen Set>Current Detail Screen>”ProductID” Field>Current Record>”ProductName” Field
4.Make the Product Name filed as read only.
5.Follow the steps 3 and 4 for all the remaining fields except ‘Unit Price’ since we are allowing the user only to update unit price field based on the selected Product ID. The remaining fields are displayed on the screen in read only mode based on the Product ID selected by the user.
Define an action named ‘Update Complex Table’ with step type as ‘Transaction’. Define an Apply step to save the transaction.
Define an Action button in any one of the screen.Publish the definitions to the agentry server.
1. Test the application in ATE.
2.Now try to update any one of the record in complex table.Select a Product ID from complex table search and update unit price as shown.Note that the remaining field values are displayed based on the Product ID selected.
3.Perform transmit or synchronization, the complex table record will be updated to back end and also retrieved on to the agentry client.
4.Finally check whether the record has been updated to the complex table on the agentry client and also back end.
Complex Table Add Transaction:
Define two data tables Categories and Suppliers.Since my database contains relation ship between Products,Categories,Suppliers.Here iam allowing the user to select Category Name based on the data table key Category ID previously selected, similarly Company Name based on the key value Supplier ID previously selected.This kind of constraint restricts the user to select only those records provided in the drop down as a result the relation ship between the tables is maintained correctly while allowing the user to update following the conditions.
1.Define categories data table and write the sync query and data query as shown below
2.Define Suppliers data table and write the sync query and data query as shown.
1. Define an add transaction for complex object.
2.Set the Key Property as Product ID.
1. Define an update step ‘Insert Complex Product’.
2.Map the ‘Insert Complex Product’ step to the Server Update Steps of the transaction ‘Add Complex’ with response set to ‘Update Client Key Property’.
1.Design a screen set for ‘Add complex’ transaction.Select the desired platform , add the transaction screen with following properties
2.select the Category ID field and change the edit type to data table selection, and specify the data table Category defined previously.
3.select the Category Name property and define the following update rule to automatically get the category name based on the category ID selected from the drop down .
4. Follow steps 2 and 3 for supplier ID and Company Name fields.select the data table suppliers for Supplier ID and write an update rule for Company Name.
1. Define an action with action step type as ‘Transaction’ ,apply step to save the transaction locally.
2.Define an action button that targets the above defined transaction action in any of the screen and publish the application.
1.Test the application in ATE.Check the number of records in complex table.Note that the complex table contains 72 records.
2.Add the records to the complex table from ATE as follows.Note that the Category Name is read only and is displayed based on the Category ID selected by the user in Category ID field.Similarly Company Name based on Supplier ID
3.Perform Synchronization.Note the messages in ATE related to complex table updation.
4.Check that the record is updated to the back end and also to the complex table in ATE.Note the number of records and also the Product ID record 86 added by the transaction.