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

SOLVED

how to create a subform with several initialized rows?

nstopak
Level 3
Level 3

I have a repeating subform in my form that should start with several initialized rows.

I can create several empty rows by setting the binding to "repeat subform for each data item" and setting the "min count", but I'd like to have values in one of the columns so this doesn't get me there.

I can create multiple instances of my named subform and initialize the value for the column in question, but then if I have the "repeat subform for each data item" checked I get additional dups of all but the first row and the delete button (with click action "this.parent.instanceManager.removeInstance(this.parent.index);") and add button (click action "_rates.addInstance(1)") behave erratically.  By this I mean the add button sometimes adds rows with values that have been deleted previously, and the delete button sometimes pops up an alert saying something like "topmostSubform[0]:Page1[0]:rates[10]:delete_button[0].click Index value is out of bounds".

There is no binding to a data source where I could pull the values for the column I wish to initialize.  I feel I'm close, if only I could find the correct settings for the binding palette.

Thanks for any suggestions!

1 Accepted Solution
Srini_Dhulipall
Correct answer by
Level 10
Level 10

If you have Columns and Rows, why not use a Table instead of Subform..

Check the binding setting to "repeat Row for each data item".

Add the "Delete Row" button to each row in the last column.

Add the "Add Row" button below the Table.

Add Text Fields to the columns you want the data to be displayed/ modified by the user.

Hope this helps.

If not, let me know..

Thanks

Srini

View solution in original post

5 Replies
dcidev
Level 8
Level 8

What values are you trying to put in the column?

Kyle

nstopak
Level 3
Level 3

Some text values that the user is free to modify.

Srini_Dhulipall
Correct answer by
Level 10
Level 10

If you have Columns and Rows, why not use a Table instead of Subform..

Check the binding setting to "repeat Row for each data item".

Add the "Delete Row" button to each row in the last column.

Add the "Add Row" button below the Table.

Add Text Fields to the columns you want the data to be displayed/ modified by the user.

Hope this helps.

If not, let me know..

Thanks

Srini

View solution in original post

nstopak
Level 3
Level 3

Thank you for the suggesting Srini.  I'm trying to implement but struggling with the scripting for the buttons and the binding settings.

I've tried the following for the click action for the delete buttons in each row:

     this.parent.instanceManager.removeInstance(this.parent.index);

and this for the click action for the add button under the table:

     rate_table._Row1.addInstance(true);

When I click on delete the javascript debugger pops up and tells me:

     GeneralError: Operation failed.

     XFAObject.removeInstance:1:XFA:topmostSubform[0]:Page1[0]:rate_table[0]:Row2[0]:delete_button[0]:click

     The element [min] has violated its allowable number of occurrences.

and when I click the add button the debugger tells me:

     General Error: Operation failed.

     XFAObject:addInstance:1:XFA:topmostSubform[0]:Page1[0]:#subform[16]:add_rates_button[0]:click

     The element [max] has violated its allowable number of occurences.

Sounds like my binding settings are wrong, but I haven't been able to determine a correct combination.  Can you assist?

Thanks in advance!

nstopak
Level 3
Level 3

I teased out a set of binding settings that seem to work for me:

For the table check Repeat Table for Each Data Item and Initial Count and set the count to 1.

Select the table rows and in the binding tab set as described for the table.

Seems both of these are required, but I'm ready to believe there are other approaches that work.

Thanks again Srini!