Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

Add New List Item with Grid Items

  • Last UpdatedJun 10, 2024
  • 5 minute read

AVEVA Work Tasks allows you to add list items with grid items to any list using XML variable. Update Variable activity can be used to perform this task. An XML Iterator type XML variable should be created to add the grid items (child items) and the XML Navigator activity can be used to point to the grid.

This can be explained through the scenario mentioned below.

A list, Purchase Orders, has been created with the following fields.

  • Reference Number

  • Purchase Order Date

  • Raised By User

  • Deliver To User

  • Status

  • Purchase Order Details

    • Item Name

    • Quantity

    • Unit Price

    • Item Total

  • Total Purchase amount

From the workflow, you have to add an item along with the child item to the Purchase Orders list.

To add a new list item with grid items

  1. Log on to the Enterprise Console and launch the Workflow Designer page. You need to create an XML List type XML variable for the Purchase Orders list. If the variable is not created, follow the below mentioned procedure to create it.

  2. Click the edit icon in the XML Variables property from the Start Activity Properties. The following screen is displayed. 

  3. Click New Variable to add a new variable.

  4. Type the variable name as 'purchaseorders'.

  5. Select XML List from the Type drop-down.

  6. Type the List name in the Select List field or click the  to select the list. In this case select Purchase Orders list.

  7. Select New as the scope from the ListItem Scope Options to point to a new item in the Purchase Orders list.

     

  8. Now you can see the XML nodes in a tree menu that are mapped to the controls while creating the list. You can also notice that the parent XML nodes and child XML nodes (PurchaseOrderDetails grid) are also displayed.

  9. Click Save Variable. A message is displayed saying 'Variable Updated'. Close the window.

  10. Drag and drop Update Variable activity to add an item in the list.

  11. Click the edit icon in the Set Variables property. The following screen is displayed.

  12. Click the Select link and select the respective field of the XML List type XML Variable created for the list (in this case 'purchaseorders'). The fields displayed in the tree-view represent the XML nodes of the controls in the list. 
     

  13. Select a field for which you want to set the value from the tree-view. Enter the value for the field in the right-hand side text box. If you want to set the value, select enter a value from the tree-view, and then type the value. Also, you can select variables or contents or any  XMLvariables nodes directly by selecting the respective node from the tree-view. If you want to combine multiple node values, you can build an expression by selecting Build Expression

  14. After setting the value for all the fields in the parent item (controls in the main form) that you want to add, click OK. This will add a list item to the list, while executing the workflow, with the fields in the main form.
    If you want to add an item to the grid (in this case, if you want to add a Purchase Order Details grid item), use XML Navigator activity. XML Navigator can be used to point to an item in the grid (Purchase Order Details in this case). For this purpose, you need to create an XML Iterator type XML Variable. This can be created from the Start activity XML variable property.

  15. In the XML Variable screen, click New Variable.

  16. Type the variable name as PurchaseOrderDetails.

  17. Select XML Iterator from the Type drop-down list.

  18. Select PurchaseOrders from the XML Variable drop-down list.

  19. Select the repeating node (Qualification) from the Node Select drop-down list.

  20. Click Save Variable. A message is displayed saying 'Variable Updated'. Close the window.

  21. Drag and drop XML Navigator activity.

  22. Select PurchaseOrderDetails from XML Iterator drop-down list and select Yes from Create New Node properties, to create a new node.

  23. Select the appropriate Location. The available options are:

    • First: Navigates to the first record in the collection.

    • Last: Navigates to the last record in the collection.

    • Next: Navigates to the next record based on the current location.

    • Previous: Navigates to the previous record based on current location.

    • Index: Navigates to the record identified in the Index field.
      Since we have to append the items in Purchase Order Details grid, select the option as Last. 

  24. Click Save.

  25. Drag and drop the Update Variable activity to enter the grid field values.

  26. Click the edit icon in the Set Variables property.

  27. Click Select and choose the respective field of the XML Iterator type XML Variable created for the list (in this case PurchaseOrderDetails), that is, grid items.  The fields displayed in the tree-view represent the XML nodes of the controls in the Purchase Order Details grid. 

  28. Select a field for which you want to set the value from the tree-view and type the value for the field in the right-hand side text box.

  29. After setting the value for all the fields in the child item, click OK. A new item with grid will be added to the list while executing the workflow.

    Note: If you want to add multiple items, use XML Navigator and Update Variable activities for Iterator within the For-Next Loop activities.

TitleResults for “How to create a CRG?”Also Available in