Skip to main content

Hello,

In my workflow, I am trying to update XML of a repeating section on my form.  I am using Nintex O365.

The data is saved in a Multi-Line Plain Text field called CERS Element Line Items.  I am able to parse the XML with no problem.  In a For Each Loop, I save the Output Index in a variable called itemElementIndex.  I use this same variable in an Update XML Action.  Below is a screenshot of the configuration of Update XML.

Regarding the long name at the end of the XPath query. I know it is right, because I am able to extract the data from the XML and I see the values in my History log.

I get the error: “An exception occurred while processing parameter aInputXML]”

What am I doing wrong?  What other information do you need?

 

18733iB2B3883553E76F1F.png

 

Hello Nintex Community,



Does anyone have any thoughts on this?


Hi,



From the screenshot I understood that you are trying to replace the content in a specific node with "No", have you tried storing the updated XML in a variable (Result XML) and then to log history? Is the updated XML in correct format?


@kchaluvadi Thanks for your reply.  I logged the data in History (see below).  In this example, it was the first instance, which is showing as 0 (zero) in the XML.  Does this look right?



 //Items/Item/0/_dee529ff55b1e8e7385ed7bd90ef974a



Is it possible to update 1 item?  Or do I need to recreate the whole XML string?  If that is the case, any ideas on how I would do that?


Hi



Is it possible to update 1 item? - Yes, as per the Nintex documentation, you can update as mentioned below.

















Selected node(s) action

Specify the operation to perform on the selected node. Select one of the following options.





  • Replace Node Contents: Replaces all content within the XML node with the supplied value.


  • Add Child Node: Adds a new node from the supplied XML fragment.


  • Set Node Text: Sets the value of the XML node to the supplied text.






 



And you can store the result of the updated XML (last field in the action, Result XML). So, update your workflow action with a variable to store the result of updated xml. Since the "log history" has limitation of number of characters to print, add an email action, insert that variable in the "message" and send that email to yourself. Once you get the email, check if the xml is valid or not, there are lot of online xml validation sites



More help on Update XML from Nintex documentation, hope it helps.


I determined what my problem is, but I am not sure how to resolve it. When I use the Update XML action, it works fine if I hardcode the index number. When I use the index 1 in this example, //RepeaterData/Items/Item[‍1‍]/_6d18d179415d8084b66a218ecb9, it works fine. However, if I try to use an integer variable in place of the 1, it does not work - //RepeaterData/Items/ItemI‍{Variable:intIndex}‍]/_6d18d179415d8084b66a218ecb931aaf. Do you have any idea why?
(PS I actually posted this as a separate question on this forum).

Have you tried log the {Variable:intIndex}‍ ? 



 



 


If Log prints correct value, 1, then the action that you are using did not like the way you are passing it. You can try different way using "Build String" action.



I just tried usig buildstring action, it worked, here is the screen shots ( I hard coded the intIndex to 1):





 



Result in Log to History List action





Hope this helps!


Yes.  It shows as 1


Ok, as shown in srceen shots in my previous reply, use a build string action to build your xml node structure and store in a vairable, "txtNodePath", and pass this variavble to your "Update XML" action.



 


Hello,



That worked - I put the whole XPath Query string in a variable instead of the just the index value and it worked.   



I have seen other people use a variable in just the index, and it worked for them so I tried to figure out why it wasn't working for me.  Turns out that the "value" I was trying to use was not compatible with the field I was trying to put it in.  When I changed the value, I was able to use the variable in the index.  @kchaluvadi but, I would not have been able to figure it out, if it wasn't for you.  Thank you!


Reply