Expand my Community achievements bar.

SOLVED

Data in dynamic table not traveling with form issue

Avatar

Level 2

Jasmin or anyone who can help,

I have a form with a dynamic table in it. When that form is filled out and submitted in Workspace only the first row of that table shows up at the next step of the process. I am submitting the form as a PDF because a signature is required and that and everything else shows up at the next step in the process but the dynamic table is giving me trouble.

I am attaching the form. It has an embedded schema and some basic calculations JavaScript in it.

Thanks for your help,

Brian

1 Accepted Solution

Avatar

Correct answer by
Level 4

The reason your table is not traveling with the form is because your schema is a bit off.

You have StockNo, descriptionArticlesServices, quantity, unit of issue, estimated unit price, amount, amount, and propcode.

Your table is set up to repeat for each data element, which is correct, but you need to reflect this in your schema.  So you'd essentially want something like this:

<xs:element name="TableInfo">

     <xs:complexType>

             <xs:sequence>

                      <xs:element name="TableRow" minOccurs="1" maxOccurs="unbounded">

                               <xs:complexType>

                                        <xs:sequence>

                                                 <xs:element name="stockNo" type="xs:string" />

                                                 <xs:element name="descriptionArticlesServices" type="xs:string" />

                                                 <xs:element name="quantity" type="xs:int" />

                                                 <xs:element name="unitofIssue" type="xs:string" />

                                                 <xs:element name="estimatedUnitPrice" type="xs:decimal" />

                                                 <xs:element name="amount" type="xs:decimal" />

                                                 <xs:element name="propCode" type="xs:string" />

                                        </xs:sequence>

                                </xs:complexType>

                       </xs:element>

              </xs:sequence>

        </xs:complexType>

</xs:element>

You can then bind the stockNo text field to the $record.P1.TableInfo.TableRow[*].stockNo

In summary, your schema is currently only showing a single item (no repeating data nodes), so you will only ever have 1 data item to input into the table.

Hope that helps!  If so, please mark it as helpful or correct!

Alex

View solution in original post

13 Replies

Avatar

Correct answer by
Level 4

The reason your table is not traveling with the form is because your schema is a bit off.

You have StockNo, descriptionArticlesServices, quantity, unit of issue, estimated unit price, amount, amount, and propcode.

Your table is set up to repeat for each data element, which is correct, but you need to reflect this in your schema.  So you'd essentially want something like this:

<xs:element name="TableInfo">

     <xs:complexType>

             <xs:sequence>

                      <xs:element name="TableRow" minOccurs="1" maxOccurs="unbounded">

                               <xs:complexType>

                                        <xs:sequence>

                                                 <xs:element name="stockNo" type="xs:string" />

                                                 <xs:element name="descriptionArticlesServices" type="xs:string" />

                                                 <xs:element name="quantity" type="xs:int" />

                                                 <xs:element name="unitofIssue" type="xs:string" />

                                                 <xs:element name="estimatedUnitPrice" type="xs:decimal" />

                                                 <xs:element name="amount" type="xs:decimal" />

                                                 <xs:element name="propCode" type="xs:string" />

                                        </xs:sequence>

                                </xs:complexType>

                       </xs:element>

              </xs:sequence>

        </xs:complexType>

</xs:element>

You can then bind the stockNo text field to the $record.P1.TableInfo.TableRow[*].stockNo

In summary, your schema is currently only showing a single item (no repeating data nodes), so you will only ever have 1 data item to input into the table.

Hope that helps!  If so, please mark it as helpful or correct!

Alex

Avatar

Level 2

That works!

Thanks so much for your help,

Brian

Avatar

Former Community Member

Hi AKloft,

I'm also in bmillhaus's situation.

I tried your solution. Its working fine for first two rows. But from the 3rd row, it is taking the same value which is present in the 2nd row of the table.

I dont know why it is happening. Can you Please suggest me to avoid this problem.

Thanks,

Susila.

Avatar

Former Community Member

Hi AKloft,

I'm also in bmillhaus's situation.

I tried your solution. Its working fine for first two rows. But from the 3rd row, it is taking the same value which is present in the 2nd row of the table.

I dont know why it is happening. Can you Please suggest me to avoid this problem.

Thanks,

Susila.

Avatar

Level 4

Susila,

Could you also provide some sample data or your schema that you would be using?  I was able to add multiple rows, but without test data and a schema definitions, it's hard to tell what I'm binding to, and based off of the bindings on the field, it should work, but without seeing the schema I can't tell if it's 100% correct (which you say it is not) or not.

Thanks,

Alex

Avatar

Former Community Member

Alex,

Here I have attached the input xml as well as xsd file and pdf.

In this xml file if I use the main tag as <root></root>, it is working fine.

But If I use the main tag as <InvoiceVO></InvoiceVO> according to the XML schema, it will not working. Why this is happening?

Please suggest me.

Thanks in advance,

Susila S

Avatar

Former Community Member

Alex,

I think u ll not get the files which i attached in the previous message. Let me send once again.

Avatar

Level 4

Susila,

The url.xml data that you uploaded didn't contain any of the repeating data.  WIthout the preview data, I can really only speculate why it's not working, but I'd suggest to try binding the Table3.Row1 to TableInfo.TableRow[*].

Try that and let me know if that seems to fix it, if not, please upload a different preview xml file so I can see data in the form.

Thanks,

Alex

Avatar

Former Community Member

Alex,

After giving the binding with  Table3.Row1 to TableInfo.TableRow[*] , it is working fine.My problem solved!!!

Thanks a lot for your help!!!!!!

Then 1 more thing is,

How to get the values which i entered in the dynamic row while clicking the simple button?

Thanks in Advance,

Susila S

Avatar

Level 4

Susila,

Which simple button are you clicking?  No matter where the button is really, you'll need to access the instanceIndex property of the row,  so let's say we have 3 rows and we wanted the 2nd row:

-----------------------------

-----------------------------

-----------------------------

each of these rows is contained in the Table, and since they are all of the same instance type (Row), we can call: Table.Row[1].subNode.value and that will get you the 2nd row's value.  If you have a set up with individual buttons for each row:

----------------------------[button]

----------------------------[button]

----------------------------[button]

then in the button's click event, you'd want to do something like:  Table.Row[this.instanceIndex].subNode.value.  Hopefully that makes some sense, but if not, just post again and I'll try to explain.  If you have an updated form from the one you uploaded here, go ahead and upload that as well.


Thanks,

Alex

Avatar

Former Community Member

Alex,

I can able to get the dynamic row values by using the following code on click of the button:

var

rowIM = xfa.resolveNode("page1.Table1.sectionRow").instanceManager;

var

j = 0;

for

(var i=0;i<rowIM.count;){

if

((xfa.resolveNode("page1.Table1.sectionRow[" + i + "].Item.Quantity").rawValue == null) || (xfa.resolveNode("page1.Table1.sectionRow[" + i + "].Item.Cost").rawValue == null)){

j

++;

break

;

}

i

++;

}

if

( j > 0)

{

displaymessage1();

}

if

(i == rowIM.count)

{

app.alert("Form Submitted...");

}

function

displaymessage1()

{

app.alert("Please enter all values");

}

Thanks,

Susila S

Avatar

Level 4

Susila,

You could also try making your message a bit more descriptive by telling the user where exactly their form needs to be completed.  for example:

var rowIM = xfa.resolveNode("page1.Table1.sectionRow").instanceManager;

var completed = true; //flag to determine if i == rowIM.count

for(var i=0;i<rowIM.count; i++){

     if( xfa.resolveNode("page1.Table1.sectionRow[" + i + "].Item.Quantity").rawValue == null  ||

         xfa.resolveNode("page1.Table1.sectionRow[" + i + "].Item.Cost").rawValue == null){

          displayMessage(i); //display the "Please enter all values" message

          completed = false; //we will not be getting to i == rowIM.count

          break; //quit checking and force a resubmit by the user

     }

}

if(completed){ //all fields filled out correctly

      app.alert("Form Submitted...");

}

function displayMessage(row){

     app.alert("Please enter a Quantity and Cost for item " + row);

}

This will shorten your code up a bit, and give the user more help with narrowing down which item they need to modify for a successful submit.  Glad you got your script and bindings working though!

Alex