Open topic with navigation

TIBCO Business Studio™ - BPM Edition 5.4.0

# Using Editable List Controls

You can bind editable list controls to data parameters of the primitive array data type.

If you have data parameters of the primitive array data type, you can bind the editable list controls to them. You can create action scripts for adding items or for deleting items from the list control. You can also add scripts for validating the values provided in the list control.

Procedure
1. Add new data parameters strArray, numArray, and decArray of the respective types Text, Number (and set the number of decimal places to 0) and Number. All of these should be of array type.
2. Add three Text controls with labels Text List, Number List, and Decimal List in to the form. Set the names of these controls to textList, numberList, and decimalList.

   For each of these controls:

   Go to the Properties tab and select the Edit as List check box.

   Go to the General tab and add a new binding for the Value that points to the value of the respective data parameter array.

3. In the form preview, you will see the three editable list controls.
4. Add a new button Add Item to the form.

   Add a new rule for this button and associate following action script for the Select event of this button. This script adds the last item into the list.

             var list = control.textList.value;
             list.push("New Value");
             control.textList.setValue(list);

5. Add a new button Delete Item to the form.

   Add a new rule for this button and associate the following action script for the Select event of this button. This script deletes the last item from the list.

             var list = control.textList.value;
             list.pop();

6. For the text control named Text List, add the following validation script for the On Value Change event. This validation is successful when the item added in the list control starts with Text. Otherwise, a problem marker appears near the list control.

             var result = true;
             var arr = context.value;
             if (arr instanceof Array) {
                var length = arr.length;
                for (var i=0; (i<length) && result; i++) {
                   if (arr[i].indexOf("Text")==-1) {
                      result = false;
                      break;
                   }
                }
             }
             result;

   Also add an error message to be displayed in case the validation fails:

       Provide input that starts with Text.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO Business Studio™ - BPM Edition

Copyright © 2015-2023. Cloud Software Group, Inc. All Rights Reserved.