Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Updating Global Variables

Avatar

Level 1

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;

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

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

Avatar

Level 1

Changing it to integer worked. Thanks!