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

AVEVA™ Work Tasks

Copy List Item with Grid Items

  • Last UpdatedJun 10, 2024
  • 6 minute read

AVEVA Work Tasks allows you to copy a list item with grid items to another list provide both the lists have the same schema. You can perform this task with the help of Update Variable activity. To iterate through the grid items, you need to create XML Iterator type XML variable for the grid. This feature can be explained with the help of a scenario.

"Telematics" is an organization which maintains a Purchase Orders list to keep a track of all the purchase orders raised by the company.

The purchase Orders contains details like:

  • 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

Telematics also maintains another list called Approved Purchase Order which has the same schema of the Purchase Order list. Now you want to copy an item with grid (Purchase Order approved) to the Approved Purchase Order list when the item is approved.

To copy a list item with grid items

  1. Login to the Enterprise Console and go to Workflow Designer.

  2. You need to create an XML List type XML variable for the Purchase Order list. If the variable is not created, follow the below mentioned procedure to create.

  3. Click the edit icon in the XMLVariables property from the Start Activity Properties.

  4. Here, for Purchase Order list you need to create an XML List type XML variable to work with the current purchase order item and XML Iterator type XML variable to loop through the child/grid nodes of the current purchase order item.

  5. Click New Variable to add a new variable.

  6. Type the variable name as 'purchaseorders'.

  7. Select type as XML List from the Type drop-down list.

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

  9. Select Current as the scope from the ListItem Scope to point to the an item in the list.

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

  11. Click Save Variable. A message is displayed saying 'Variable Updated'.

  12. Now, you need to create XML Iterator type XML variable to iterate through the child nodes (in this case, PurchaseOrderDetails). For that, click New Variable from the XML Variable screen.

  13. Enter the variable name as purchaseorderdetails.

  14. Select XML Iterator as type from the Type drop-down list.

  15. Select purchaseorders from the XML Variable drop-down list.

  16. From the Node Select drop-down, select the repeating node, that is PurchaseOrderDetails.

  17. Click Save Variable. A message is displayed saying 'Variable Updated'.

  18. In the same way you have to create XML variables for Approved Purchase Order list. For Approved Purchase Order list, you need to create XMLList type XML variable to add an item and a XML Iterator type XML variable to map to the grid items of the new purchase order item.

  19. Click New Variable to add a new variable, from the XML Variable property of Start activity.

  20. Enter the variable name as approvedpurchaseorders in the Variable Name field.

  21. Select XML List as type from the Type drop-down list.

  22. Enter the List name in the Select List field or click the icon to select the list. In this case, select Approved Purchase Orders list.

  23. Select New as scope from the ListItem Scope Options to point to the new item in the list.

  24. Now you can see the XML nodes in a tree-view 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.

  25. Click Save Variable. A message is displayed saying 'Variable Updated'.

  26. You need to create XML Iterator type XML variable to iterate through the child nodes. For that, click New Variable from the XML Variable screen.

  27. Enter the variable name as approvedpurchaseorderdetails.

  28. Select XML Iterator as type from the Type drop-down list.

  29. Select approvedpurchaseorders from the XML Variable drop-down list.

  30. From the Node Select drop-down, select the repeating node, that is PurchaseOrderDetails.

  31. Click Save Variable. A message is displayed saying 'Variable Updated'.

  32. Drag and drop Update Variable activity to set value for the parent nodes or the item.

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

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

  35. Select a field for which you want set the value from the tree-view under approvedpurchaseorders. The selected variable for the field Title will be displayed in the text box as 'XMLVariables.approvedpurchaseorders.ApprovedPurchaseOrders.Title.'

  36. Enter the value for the field in the right-hand side text box. Select the respective field of the purchaseorders XML variable (purchase order item to be copied). The selected XML variable for the field will be displayed as 'XMLVariables.purchaseorders.PurchaseOrders.Title'. Set the value for all other fields in the same way.

  37. After setting the value for all the fields in the parent form (controls in the main form) that you want to add, click Ok. This will add a list item to the new list (Approved Purchase Order), while executing the workflow, with the values in the current Purchase Orders item.

  38. Next, you need to iterate through the grid/child items of the current purchase order and to add the child items in the new list (Approved Purchase Order). Drag and drop ForEach-Loop activity to loop through the grid items.

  39. Select XML Iterator type XML variable that you have created for the current Purchase Order from the XML Iterator drop-down list (in this case, purchaseorderdetails).

  40. 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 (purchaseorderdetails in this case).

  41. Drag and drop XML Navigator activity.

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

  43. 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.

  44. Click Save.

  45. Drag and drop Update Variable activity to set the value for the grid item fields of the new list item.

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

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

  48. Select the XML variable PurchaseOrderDetails from the tree-view. You can either select PurchaseOrderDetails node or select all child nodes separately. In this case, you are selecting the PurchaseOrderDetails node. The variable will be displayed in the text box as 'XMLVariables.approvedpurchaseorderdetails.PurchaseOrderDetails'.

  49. Set the value in the right-hand side text box. Select the respective field of the purchaseorderdetails XML variable (purchase order item to be copied) from the tree-view. The selected variable will be displayed in the text box as 'XMLVariables.purchaseorderdetails.PurchaseOrderDetails'.

  50. After setting the value for the fields in the child item that you want to add, click OK. This will add a grid item to the new list (Approved Purchase Order), while executing the workflow, with the values in the current (Purchase Order) list.

    Note: You can also select each node in the grid separately and set the value for each node.

  51. Complete the loop with a Next activity and finish the workflow with appropriate link conditions.

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