XML datasource rebind - InfoPath Dev
in

InfoPath Dev

XML datasource rebind

Last post 08-03-2011 10:47 AM by przemek. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-03-2011 09:45 AM

    XML datasource rebind

    Hello, 

    i have a repeating table on the form that takes data from secondary data source which is XML document in my case. Repeating table has 3 columns - each node in xml document has 5 elements so table displays only 3 values out of 5 for each node. The file has already some data inside to display. Another thing on the form is a set of 5 textboxes + button. with those text boxes i'm able to add new nodes in secondary data source, but i don't know how to inform repeating table that secondary data source has changed and therefore it should rebind itself with the file to get newly added rows. I've tried DataConnections[].Execute() but it doesn't work for me.

    So with textboxes i want to have ability to add new items to data source and repeating table serves as master view (it doesn't show all possible columns it could). Repeating table should be updated whenever new item to data source is added.
  • 08-03-2011 09:52 AM In reply to

    Could you describe more specifically what the 5 textboxes + button do?  In what way are they adding new nodes to the secondary data source?  If you have code that's adding new elements to a repeating group, they should show automatically without some sort of manual refresh.

    Perhaps the nodes you're adding to the data source have the node names misspelled or something like that, or they're being added to the wrong place?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-03-2011 10:17 AM In reply to

    Let's assume each node in data source has elements 'Last Name' , 'First Name', 'Postal, 'Country' and 'City'. That XML is connected with Repating Table to display data, but only three values from xml doc are displayed (last name, first name and city). There is also another column in that repeating table, with a button inside. if you click the button in particular row then all data from that node will be displayed somewhere on the form (this means 3 values that are already visible in that row + 2 values <Postal and Country> not visible in repeating table but reachable thanks to xml datasource).



    On this form there are also 5 textboxes ('Last Name' , 'First Name', 'Postal, 'Country' and 'City') used to gather input from user to create new node in datasource. Button is just for submitting data to datasource. When you click that button, new node is created in datasource and new row to repeating table should be added. It would be great if i could say somehow to repeating table : 'hey, user just added new node to xml data source, grab 3 new values (out of 5) and add new row to populate with those data'. ;) Now, i'm able to correctly alter xml document (i'm using xmlwriter inside button click event) but i don't know how to programatically refresh repeating table (in click event right after altering datasource).

  • 08-03-2011 10:26 AM In reply to

    As I already said, if you are adding nodes to the data source correctly, you don't need to do anything to refresh the table.  It will refresh on its own.

    Could you attach a screenshot of your secondary data source and paste your code that is adding the new nodes?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-03-2011 10:47 AM In reply to

    I found a problem it was regarding node's namespace. Nodes that already were in datasource don't have namespace attribute. When i pass empty namespace then repeating table gets refreshed properly. THANKS for your help and attention to my problem Jim!
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.