Connect dynamically created fields to ODBC database

DKinsley 13-04-2017

Can anyone help me with a script to connect dynamically created table rows/fields to an ODBC database (MS Access)? For example a table with multiple fields for Customer Name, Phone Number, Address, etc.

I have several forms that I have connected static fields to MS Access but not dynamically created fields. I would use the FormID as the unique data point.

FormIDCustomer NamePhone Number
Address
1Mr. Jones315 999 9999127 Adtkins Dr, Liverpool, NY
1Mrs. Smith215 888 4568200 Block Ave, Hardrow, NJ

What I really need help with is a script to count the number of repeatable rows present and perform an action to each of those rows. To have the script count the number of instances of Row1 and then script that the rawValues of each field contained in the visible repeatable table1 Row1 equals the rawValues of the hidden repeatable table1 Row 1 that are bound to the database columns.

HiddenSubform.Table1._Row1.CustomerName.rawValue = VisibleSubform.Table1._Row1.CustomerName.rawValue;

HiddenSubform.Tabe1._Row1.PhoneNumber.rawValue = VisibleSubform.Table1._Row1.PhoneNumber.rawValue;

DatabaseName.update();

Any help is appreciated!

Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (3)

Answers (3)

DKinsley 19-04-2017

I have a two tables with a header and one row, two columns.

Fields are named "Name" and "Address".

The row is repeatable with an "Add Row" button.

One table will be visible to the user the other hidden.

I am trying to get the data that the user enters into however many rows they create to populate the other table in the same way.

Here's my script from what you shared with me. What do I have wrong?

var rowNodes = Form1.Visible1.Table1.Row1.instanceManager.count;
for(var nNodeCount=0; nNodeCount<rowNodes;nNodeCount++)
{
Hide1.Table1.Row1.instanceManager.addInstance();
xfa.resolveNode("Form1.Hide1.Table1.Row1[" + nNodeCount +"].Name").rawValue = xfa.resolveNode("Form1.Visible1.Table1.Row1["+ nNodeCount + "].Name").rawValue;
xfa.resolveNode("Form1.Hide1.Table1.Row1[" + nNodeCount + "].Address").rawValue = xfa.resolveNode("Form1.Visible1.Table1.Row1[" + nNodeCount + "].Address").rawValue;
}