Apps
latest
false
Banner background image
LEGACY
Legacy Apps User Guide
Last updated Jan 18, 2024

Work With Data Source and Value Bind

Background Information

Data Source and Value Bind fields of a control are two-way bound, meaning they can both update the root data that is bound to that control.

To better understand this, we can use a simple example. You can try adding a label and a textbox to an app, then create an app variable. Assign the Value binding property of the textbox control and the Text property of the label control to the variable. When previewing the app, notice that when you change the value of your textbox, the app variable is updated as well. On the other hand, the Text property is a one-way bound field, only displaying data that cannot be updated.

Example

In this example we will build an app where the user can select multiple items from a custom list that comes from a process.

For this example we will build the following:

  • An automation process
  • An app using UiPath Apps

Building the Workflow

The first step of this example is building the workflow in UiPath Studio. This is a simple workflow, consisting of a few arguments.

  1. Open Studio and create a new Process.
  2. Create the following arguments:

    Argument name

    Direction

    Argument type

    Default value

    out_DataTable

    Out

    DataTable

    -

    in_SelectedItems

    In

    DataTable

    new DataDable
    filtered_SelectedItems

    Out

    DataTable

    -

  3. Drag a Sequence to the Workflow Designer.
  4. Add a Build Data Table activity inside the Sequence container.

    • Add the out_DataTable argument in the DataTable field.
    • Add a column named Selected.
    • Configure the table as in the figure below:



  5. Add an If activity below the Build Data Table activity and follow the steps below to configure it.

    • Add in_SelectedItems.Rows.Count > 0 in the Condition field.
    • Configure Then and Else as displayed below.

      Then

      1. Drag a Sequence inside the Then container.

      2. Add an Assign activity inside the Sequence container.

      - Add filtered_SelectedItems in the To field.

      - Add (from r In in_SelectedItems.Select() Where r("Selected").Equals(true) Select r).CopyToDataTable in the Value field.

      3. Add a Log Message activity below the Assign activity.
      - Set LogLevel to Info.
      - Add filtered_SelectedItems.ToString in the Message field.

      Else

      1. Drag a Sequence inside the Else container.

      2. Add a Log Message activity below the Assign activity.

      - Set LogLevel to Info.
      - Add "First run or empty" in the Message field.

Result

In the end, the workflow should look as the one in the figure below.



Important:

If your process is making use of a complex .NET object in its input or output (eg DataTable), App Studio doesn't know what the fields of that object are by default. There are two ways you can specify this:

  • Run your process before adding it to your app. If a process uses an object, Apps will check its Job History to automatically detect the schema/fields of that object.
  • Manually specify object fields for process input/output. If your process has no job history then after it has been added to your app you must manually specify its fields in order to use them in your app.

Manually added parameters to a process will be removed if the process is refreshed.

Building the App

After publishing the workflow build during the Building the workflow procedure to your Orchestrator, it's time to build the app itself.

  1. Create a new app.
  2. Reference the process built above.
  3. Add one Custom List control and one Table control to your app, next to each other.
  4. In the Data source field of the table, add Out: out_DataTable from the process.


  5. Add a Checkbox control and a Textbox control to the custom list and configure them as follows:
    • Add the Out: Item item from the Out: out_DataTable section of the process in the Label field of the checkbox control.
    • Add the Out: Selected item from the Out: out_DataTable section of the process in the Value binding field of the checkbox control.
    • Add the Out: Quantity item from the Out: out_DataTable section of the process in the Value binding field of the textbox control.
  6. Add a Button control and name it Run. Configure the Clicked on rule as follows:
    • Add a Start process rule.
    • Add a name in the Job name field and mark it as Attended.
    • Add in_SelectedItems and Out.out_DataTable in the Input Override field.


  7. Add a container below the button.
  8. Add two Label controls next to each other.
    • Add the filtered_SelectedItems.Item item from the Out: filtered_SelectedItems section of the process in the Text field of the first label.
      • Add the filtered_SelectedItems.Quantity item from the Out: filtered_SelectedItems section of the process in the Text field of the first label.

Conclusion

When previewing the app, you will be able to select items in a custom list that comes from a process.



The key of this example is to better understand the difference between Data Source, Value Bind, and input:

  • Data Source and Value Bind are two-way bound. This means that they can both update the root data that is bound to a control.
  • Input override allows you to pass in objects from other sources, such as a data table from a process, or an entity from Data Service.
  • Background Information
  • Example
  • Building the Workflow
  • Building the App
  • Conclusion

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.