Updating Global Variables

MikhaelJ

14-06-2017

I am trying to use a global variable to update row numbers in a repeating subform. I defined a variable 'rowCount' where the value is "1" from the Form Properties > Variables menu. I would like that value to go up by 1 whenever a user clicks something like an 'add row' button. I tried the following, and searched around but can't seem to find the answer:

rowCount.value = rowCount.value + 1;

Accepted Solutions (1)

Accepted Solutions (1)

_Bruce_Robertson

MVP

16-06-2017

Hi,

Your code should execute, though rowCount.value will be a string so you will get concatenation, so "11", "111", "1111" etc.

The Designer UI does not support numeric global variables but you can create them by using the XML Source view.  You will find something like;

<variables>

    <text name="rowCount">1</text>

</variables>

You can then change the text elements to integer, so it looks like;

<variables>

     <integer name="rowCount">1</integer>

</variables>

There is more on this in this blog post, Form Variables

An alternative approach would be to use the index property of the repeating subform, this property is incremented for each object with the same name.  There is an example of this in another blog Adobe LiveCycle Designer Cookbooks by BR001: Numbering rows in a LiveCycle Designer table or repeati...

Regards

Bruce