Form Designer: How to bind a text box field to a global list


#1

You can bind a text box field to a global list so that when a user selects an item in a drop-down list, the text box field is then updated with the corresponding value from another column of the global list. In the following example, the list contains TASK_ID as the value and the text box contains the description.

  1. On the Databind tab, create a drop-down list bound to a global list.

  2. On the Custom attributes tab, call a method on the OnSelectedIndexChanged event and set the autopostback event to true.

  3. Create a text box with the ID DESCRIPTION.

  4. In the .NET code, add the following code to bind the text box to the global list on the SelectedIndexChange event:

private void Task_OnSelectedIndexChanged(object sender, EventArgs e)
    {
        WorkflowGen.My.Integration.GlobalLists gl = new WorkflowGen.My.Integration.GlobalLists();
        System.Data.DataTable GLOBAL_LIST_DATA;
        GLOBAL_LIST_DATA = gl.fetchList("GLOBAL_LIST_DATA", "DESCRIPTION", "en-US", true);
        REQUEST_DESCRIPTION.Text = GLOBAL_LIST_DATA.Rows[REQUEST_TASK_ID.SelectedIndex - 1]["DESCRIPTION"].ToString();
    }

Try it out for yourself!

  1. Download BINDING_FEATUREv1.xml.zip (the process definition), unzip it, and import it into WorkflowGen as a new process.

  2. Download GLOBAL_LIST_DATA.xml.zip (the global list), unzip it, and import it into WorkflowGen as a global list.

  3. Open the BINDING_FEATURE v1 process and click Test.

  4. For Existing Project?, click the Yes radio button, and select a Project Name from the drop-down menu.

  5. For Update existing task?, click the Yes radio button, and select a Task ID from the drop-down menu.

You’ll see that the rest of the fields will automatically be filled with the corresponding information from the global list.


Can you use data in a global list to assign the next participant?
#2

The line in the .NET code:

“GLOBAL_LIST_DATA.Rows[REQUEST_TASK_ID.SelectedIndex - 1][“DESCRIPTION”].ToString();”

should have "REQUEST_DESCRIPTION.Text = " in front of it, no?


#3

Yes, that is correct. Thank you for the feedback.
The article is now updated.

Best Regards,
Eddy.


#4

No problem, the tutorial was very helpful and I just wanted to make sure others wouldn’t get confused.

Regards,
Jack


#5

Hi, is this text box option for databind tab available using the form designer in the wfg v7.5 release? I am not seeing it. If not which release is it added?


#6

HI Karen,

The databind feature is only available for List controls such as ListBox and DropdownListBox .
For other controls, you would need to use the code behind to perform the databind.

Regards,
Eddy.