Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Initialising a table column

SilkMill
Level 1
Level 1

Hi,

New to SAP Adobe and complete beginner at scripting.

I have an interactive form with a table which contains a grouping; hierachy view looks like this:

data

     subform1

          table1

               data (row)

                    field1 (grouping field)

                    cell_table

                         data (row)

                              field2

                              field3

                              field4

          

Field4 is the only input field in the table. I have a pushbutton which I would like to initialise (clear) all occurrences of field4 in the table, but I haven't been successful.

I tried various combinations of $host.resetData("data.subform1.table1[*].data.cell_table[*].data.field4"]; but the best result was the initialisation of only the first occurrence of the field in the table.

 

Do I need to loop at all occurrences of table1, and within that loop, all occurrences of cell_table, and (resetData?) each field4 that way, and if so, how do I do it?

Apologies if this has been covered before, I've searched but not found....

 

Any help would be much appreciated.

Thanks.

Nigel. 

1 Reply
SilkMill
Level 1
Level 1

Moved forward a little I think.

When I have two groups of 10 rows in the table, like:

Group1          f1     f2     f3     f4

                    f1     f2     f3     f4

                    f1     f2     f3     f4

                    &etc. for 10 rows

Group2          f1     f2     f3     f4

                    &etc. for 10 rows

then this works:

for (var iRow = 0; iRow < 2; iRow++)

     {

          for (var nRow = 0; nRow < 10; nRow++)

               {

                    xfa.host.resetData("data.subform.table1.data[" + iRow + "].cell_table.data[" + nRow + "].field4");

               }

     }

Sadly I don't know how many groups or rows within groups there are....!

Having got this far can someone point me towards the finish line - how can I tell how many groups (entries) there are in table 1, and within each of table 1, how many in cell_table?

Thanks....