Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

Inserting Multiple instances into a databse


Level 7
I am using MySQL to capture the form data. In the form I have a Driver License section which can have multiple instances.

In the workflow I am using the "Execute SQL query" module to insert data. Initially I can insert information from the non-repeating subforms, successfully. However, workflow inserts no information from repeating subforms. Below is an example of the XPATH used.


Is the above format correct ? How can I insert the second and third instances ?


5 Replies


Level 10
You would need to call the "Execute SQL query" a second time and pass the information for the second driver licence section.

Something like /process_data/xfaform/object/data/xdp/datasets/data/App/DriverLicense/drvlicstate[2]



Level 7
In my workflow, there could be different results of driver license information. Sometimes there could be one or more instances.

Are you suggesting that I will need one SQL query for every instance ? Is there a way to created a loop ?

"Something like /process_data/xfaform/object/data/xdp/datasets/data/App/DriverLicense/drvlicstate[2]"

Just to clarify - would it be the DiverLicense[2] or drvlicstate[2] ? In other words, would I specify the instance on the subform or the field ?



Former Community Member
Yes you can and will have to set up a loop in your process. Use an integer process variable as your loop increment start it at 1 (I'm pretty sure the indexing begins at 1...could be 0). You'll have to use the count() XPath function to count the number of nodes. Something like...


Compare that number with the index value to know if you've looped through every node (and inserted each, one at a time) or if you need to loop again. Email me and I'd be glad to discuss this further with you if need be. It's not as complicated as it sounds.

Hope this helps!

Ryan D. Lunka

Cardinal Solutions Group



Level 10
"Just to clarify - would it be the DiverLicense[2] or drvlicstate[2] ? In other words, would I specify the instance on the subform or the field ?"

I think you'll need to get to use DriverLicense to get the count of how many driver licenses you have.


then you can have a loop (just a route coming back to a previous step) that get the value using something like:




Level 9
You can set up a loop as described, or you can do it in a single step using the following custom component:

Docs: http://avoka.dnsalias.com/confluence/display/Public/XML+to+SQL+DSC

Download: http://www.avoka.com/avoka/escomponents.shtml