Expand my Community achievements bar.

SOLVED

Dynamic forms and Web Services?

Avatar

Level 2

So what we are trying to do is get a dynamic form's information into a database.  On the form itself we have several fields wrapped in a subform that is set to repeat.  It is bound to an element from a web service, which allows the form to grow based on the number of rows returned.  We needed to do this because depending on the selection of departments, there could be a different number of rows returned each time.  This works out fine.  The form grows to display different options, based on the selection.

What we're having problems with is writing the changes made back to the database.  We have a web service that is bound to the subform that contains the fields, and also bound to the fields themselves, but we're only able to write the information from the last node, i.e if there were six options that were displayed, and you made changes to all six, only the changes to the last one would be written to the database.  Is there something special that needs to be done on the form side?

Any help is much appreciated.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Yes ...you set up the web service to recieve one parameter .....then you create a multiline field (make it invisible so the user cannot see it). Then use this command to populate the field with the form data:

fieldname.rawValue = xfa.datasets.data.saveXML("pretty");

Now bind this field to the web service input and call it.

Paul

View solution in original post

4 Replies

Avatar

Former Community Member

You may want to try adding a [*] to the end of the repeating node on the binding expression but I am not sure that will work. This indicates that there is a repeating node.

If that does not work then you may have to submit back all data to the web service and parse out what you need up there.

Paul

Avatar

Level 2

Tried to use the [*] but it wouldn't allow me to.  The Binding area is greyed out, and only shows the binding, by selection.  When you say 'submit back all data to the web service and parse out what you need up there.'  Would you happen to know how to do this?  Or is there an example you can direct me to?

Mike

Avatar

Correct answer by
Former Community Member

Yes ...you set up the web service to recieve one parameter .....then you create a multiline field (make it invisible so the user cannot see it). Then use this command to populate the field with the form data:

fieldname.rawValue = xfa.datasets.data.saveXML("pretty");

Now bind this field to the web service input and call it.

Paul

Avatar

Level 2

Thanks a bunch for your help.  We got it.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----