Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library) - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

Last post 06-09-2014 07:44 AM by Hilary Stoupa. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 06-02-2014 08:25 PM

    Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    Hi all,

    I've read numerous posts on here about this topic, but I'm stumped. 

    I have two separate InfoPath web forms (segregated for privacy concerns); let's call them "Form Template 1" and "Form Template 2".

    Form Template 1 houses a repeating table with field "Name".  Each new form, created off of Form Template 1, is saved with a unique ID and uploaded to a SharePoint Library.

    My issues arise when I attempt to reference Form Template 1's SharePoint Library as a secondary data source in Form Template 2.  In particular, my goal is to create a duplicate and editable repeating table based on a specific Form Template 1 Item.  For example; A user can create a new Form based on Form Template 2.  From there, the user can select to pre-populate the data with a specific Form from Form Template 1.  However, when referencing the Form Template 1 as a secondary data source, I can only reference/pull-in the first row of data per each unique form entry in the database.  I am well aware of how to reference multiple first-row entries of separate forms, but my issue is getting the data that is repeated amongst the specific "Name".  In other words, getting the secondary fields values of a field located in a repeating table.

    Here's a visual that may explain better: http://i.imgur.com/UHsnKn2.png?1

    Here's also an example of some code I've utilized (VSTA - VB) to pull each form's "Name" field on a 'form load event':

    -----------------------

    'SecNav = Secondary Data Source Path/Name

    'SecNavRows = Path/Node Iteration

    Dim SecNav As XPathNavigator = Me.DataSources("GRC FI FL RECEIVE").CreateNavigator()

    Dim SecNavRows As XPathNodeIterator = SecNav.Select("/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW", NamespaceManager)

    While SecNavRows.MoveNext()

    MessageBox.Show(SecNavRows.Current.SelectSingleNode("d:CUSTOMER_x0020_NAME", NamespaceManager).Value)

    End While

    -----------------------

    As you can see, the code simply cycles through each form's 'Customer Name' field and outputs the first row's value, but what'd I'd love to get is the ability to say "d:CUSTOMER_x0020_NAME[VARIABLE ROW POSITION]", but any time I use this one a secondary data source, it fails.  I've also tried current() filter solutions and I just can't seem to get the convention right.  Any help would be greatly appreciated!

     Nick

  • 06-04-2014 04:38 PM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    Well I found a solution for this (Q rules) or a very dirty method of concat'ing all fields with a delimmiter and then splitting them out on the second form template and programmatically adding the amount of rows needed per each repeating section/table.  Sad this basic functionality is handled in such a complex manner!

  • 06-04-2014 04:45 PM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    Sorry I was slow to notice this - but couldn't you just create a data connection (XML) to a file in the library? Then use qRules / code to change that data connection to point to the correct XML prior to querying it? Then you'd have the actual repeating table from the original XML file in your secondary data source...

    Hilary Stoupa

  • 06-06-2014 10:12 AM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    No problem Hilary; the difficulties associated with using qRules is this process is being developed in our admin-restricted work environment (lots of privacy related information for our customers), so implementing third-party solutions incurs costs, additional oversight, etc (i.e. most software implementations need to have an enterprise viability and since our group is significantly smaller compared to the organization as a whole, the cost unfortunately cannot be justified).  In short, I'd love to use qRules if the option was available to us for free and I could easily access it without pestering our technology department ;).

     Thanks,

    NIck

  • 06-06-2014 10:19 AM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    But is custom code ok? You can do this with code....you need to change the connection URL for the XML file then query it.

    Hilary Stoupa

  • 06-06-2014 10:41 AM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    I do have the ability to request our technology department to post an admin-approved form template (sandboxed environments are disabled), so yes, I can implement some coding features.  I tried toying around with how to pull each individual XML document , but I couldn't get the loading procedures quite right with our sharepoint site (I kept running into issues with System expressions resulting in insufficient permissions despite my repeated attempts to copy over the default credentials of the website and/or specifying username/pass/domain/etc).  Do you have an example that I could build from?

  • 06-06-2014 12:43 PM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    Well, first simply add an XML data connection to an existing file in the library - is that where you started? Are you having permissions issues just creating a data connection to an existing XML in the library?

    Hilary Stoupa

  • 06-06-2014 01:03 PM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    Well I'm definitely not an expert on the topic, but since you recently mentioned adding a connection URL, I was able to google a MSDN site reference to SharePointListRWQuestyConnection, which I've now used to build out at least loading the Query with;

    -------

    Dim SPList As SharePointListRWQueryConnection = DirectCast(Me.DataConnections("Secondary Database Name"), SharePointListRWQueryConnection)

    Dim SpListConnection as DataConnection = SPList

    -------

     This is about as far as I've got so far, testing around more from there.  The method I was attempting to utilize before regarding pulling specific XML documents was through an XMLreader and passing that into XMLdocument.Load() which I don't believe was what I was quite looking for (despite the naming convention misleading me a bit there).  You got me on the right path now (I think), but any further direction is of course appreciated as far as now pulling in the XML documents per the SharePointListRWQueryConnection.

    Thanks again,

    Nick

  • 06-06-2014 02:06 PM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    I'm not being clear enough.

    Here is what I would do if this were my form.

    I would:

    1. Add a new receive data connection to my form using the data connection wizard. This would connect to an XML file. For the location, I would put in the URL of an XML that is the created by the form that you want to copy data from. I would set the connection to NOT add the XML as a resource file, but to query it from its current location. I would set the data connection to NOT query on load
    2. At the appropriate point in the form, when I know what the form is the user would like to get data from, I would programmatically change the URL for the data connection and then query it.

    Here are some MSDN links that may help you:

    http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.filequeryconnection(v=office.14).aspx
    http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.filequeryconnection.filelocation(v=office.14).aspx

    I hope that makes more sense now? One benefit of this approach is that by leveraging an existing data connection, your form does not have to be full trust.

    At that point, you'll have the XML from the original, in its original state, and can do what you need with it.

     

    Hilary Stoupa

  • 06-06-2014 02:40 PM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    No problem, I appreciate the help and what you laid out here does clarify it better for me :).  I'll look over your provided resources and see if I can put something together.  More to come and thanks again!

  • 06-06-2014 06:08 PM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    You are truly wonderful.  Your guidance has allowed me to create the following sample code of my Subroutine that utilizes & manipulates the setup of a default XML connection titled "XML Connection".  I think we can consider this one resolved. Cheers and have a great weekend!

    :::::::::::::::::::::::::::::::::::::::: 

    Dim MainNav As XPathNavigator = Me.CreateNavigator() 'SETUP MAIN XPATH NAVIGATION OF GRC TEMPLATE FORM

    Dim XMLFileName As String = MainNav.SelectSingleNode("/my:myFields/my:Admin_Submit_Data_Pull", NamespaceManager).Value & ".xml" 'DETERMINE XML FILE TO PULL

    If XMLFileName.Length() < 5 Then 'IF NO FILE SELECTED, DO NOT RUN SUB

    MessageBox.Show("No File Selected")

    Exit Sub

    End If

    Dim XMLFileConnection As FileQueryConnection = Me.DataConnections("XML Connection") 'Set XML File Connection Query

    XMLFileConnection.FileLocation = "http://sp.com/xml library folder/" & XMLFileName 'Update XML File Location

    Me.DataSources("XML Connection").QueryConnection.Execute() 'Pull in XML Data

    Dim XMLFileNavigator As XPathNavigator = Me.DataSources("XML Connection").CreateNavigator() 'Create XML File Navigator

    Dim XMLFileRows As XPathNodeIterator = XMLFileNavigator.Select("/ns1:myFields/ns1:Customer_Account_All/ns1:Customer_Account_Name_All", NamespaceManager)

    While XMLFileRows.MoveNext()

    MessageBox.Show(XMLFileRows.Current.SelectSingleNode("ns1:CUSTOMER_NAME", NamespaceManager).Value)

    End While

  • 06-09-2014 07:44 AM In reply to

    Re: Q: Get/Pull/Read ** ALL ** Repeating Table Values of a Secondary Data Source (SharePoint Library)

    Excellent! So glad you have it doing what you need. :)

    Hilary Stoupa

Page 1 of 1 (12 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.