Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Connect dynamically created fields to ODBC database

Avatar

Level 9

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!

3 Replies

Avatar

Level 9

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;
}

Avatar

Level 4

I created a sample for you please check Dropbox - DuplicateTable.pdf

For more modification please send your query to lcdesignerforms@gmail.com