I am trying to grab only the first instance of an element from an xml document in Mapforce but I can’t find a function in the default set libraries that does this. Does anyone know how to create a custom User-Defined function that can do this or any other way to accomplish this?
There is also a chance that these elements might occur in separate locations. E.g. There is 3 Person elements ({Person id=”1″} {Person id=”2″} {Person id=”3″}) and all might have a single FirstName element, but I just want the {Person id=”1″}’s FirstName element. So the row position of each FirstName element is 1, even though there are three of them that occur throughout the document.
Also does anyone know of any websites with some good information on the syntax used in a custom User-Defined function?
The
positionlibrary function, found under node functions should do the trick. Plug the node you’re checking into its output, then plug the result into anequalsfunction into theainput. For thebinput, insert aconstantequal to the increment you want to check for.Note that when generating C# code, the position function will trigger an error if no input nodes are actually present in your XML source doc. Seems like you’