Getting values from field in repeating section

L

Leon

I have a field called "RequestType" populated from a drop-down list in a
repeating section. When the user submits the form, I need to iterate through
the values in this repeating field to apply logic based on what has, or has
not, been entered into this field. The value of
XDocument.DOM.selectSingleNode("//my:RequestType") is always the first value
entered, even if several request types have been selected.

How do I get all of the values from the repeating field? Is this something I
can do in VBScript behind the form?

Thanks,
Leon
 
K

K.Ramana Reddy(GGK Tech)

Hi,

You need to get the all repeating values using selectNodes, then you can
iterate all nodes using any loop.

I hope this will help for you.
 
L

Leon

Thanks Ramana. I'm trying the approach you suggested, but am getting errors.
When the form's filled out, there can be multiple values for "RequestType".
That's the node I need to iterate. Here's the way my data is structured:

Data Source:

myFields (root)
-Requests (repeating group)
-RequestType (drop-down text field inside the Requests repeating
group)

The "Requests" repeating group is on the form in a repeating section.

This code is supposed to return the "Requests" node count, but it returns 1
no matter how many requests are entered. None of the syntax I've tried will
give me the "RequestType" field. What am I doing wrong?

(VBScript)

Sub GetNodeValues()
Dim objMyNode, objXMLNodes

set objMyNode = XDocument.DOM.selectSingleNode("//my:Requests")
XDocument.View.SelectNodes(objMyNode)

set objXMLNodes = XDocument.View.GetSelectedNodes()

XDocument.UI.Alert(objXMLNodes.Count)

End Sub
 
K

K.Ramana Reddy(GGK Tech)

Hi,

Use below line of code for the line
set objMyNode = XDocument.DOM.selectSingleNode("//my:Requests")

Use this:
set objMyNode = XDocument.DOM.selectNodes("//my:Requests")

I hope this will help for you.
 
K

K.Ramana Reddy(GGK Tech)

Hi,

Use below line of code
set objMyNode = XDocument.DOM.selectNodes("//my:Requests") instead of line

set objMyNode = XDocument.DOM.selectSingleNode("//my:Requests")

I hope this will help for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top