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.

Populate form fields using DataConnection and SQL query

Avatar

Level 1

Hi. I have a local database. I can connect to it from my form which has several text fields binded to the DataConnection fields.

The idea is to locate a certain record in the database and fill these fields with corresponding values.

I have a button whith defined click event with the following simplest script 

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

topmostSubform.Page1.Button1::click - (JavaScript, client)

xfa.sourceSet.DataConnection.resolveNode("#command").query.commandType = "text";

xfa.sourceSet.DataConnection.resolveNode("#command").query.select

= "SELECT * FROM records WHERE InternalID = '000-00-0024'";

xfa.sourceSet.DataConnection.open();

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

No errors or warnings, but the fields are not updated with new values (those are set with the first record of the table).

The event handler works - I tried to execure some code in there.

If any ideas how to fix it please drop me a line.

Thanks,

MaxCompana

2 Replies

Avatar

Level 1

Maybe you have found solution since...? Im also trying to populate through odbc certain fields on the form, which must change when primary/unique field is updated. Please advise me of how such can be assembled. Thanks

Avatar

Level 1

Hi, i just gave up and wrote a C++ program to be an "interface"for the

forms. It is not an elegant solution but it a fast and easiest one. Good

luck. Let me know if you succeded with the forms... i didnt...