May 2008 - Posts - David Airapetyan
in

InfoPath Dev

David Airapetyan

May 2008 - Posts

  • Browser forms and DBXL

    Getting browser forms to work with Qdabra DBXL is pretty straightforward. The most important part of it is to install DBXL into the same web application as the SharePoint front end (typically into the web site that runs on port 80). This is needed for the authentication to work properly – otherwise more advanced authentication schemes such as Kerberos delegation may need to be used.

    Once DBXL is installed it is sufficient to convert existing DBXL data connections into UDC files and everything will work as-is. However, there is one challenge with the DBXL/SharePoint integration and this is the fact the InfoPath Forms Server can only open documents from SharePoint document libraries.

    Luckily, browser forms allow users to pass in custom parameters via the URL. This gives rise to the following solution for listing and opening documents from DBXL (these steps require SharePoint Designer):

      1.       The first step is to add a data view to SharePoint site that would list all documents that the user is interested in (one way would be to list the contents of the DBXL's Document table filtering by Type). Jeff Tangen's post provides steps on how to add a data view.

      2.       Add a column to the data view (or modify an existing one) to link to the form template, passing in the docid as a parameter.

     
    3.       In the form code's Loading event, inspect the LoadingEventArgs.InputParameters member to check for the docid. If passed, use a regular data connection to DBXL (the GetDocument method) to retrieve the document and replace the main DOM with the retrieved XML. 


    Here is how the hyperlink to the form can look like in the data view:

    <a target="_blank"><xsl:attribute name="href">http://server/_layouts/FormServer.aspx?XsnLocation=xsnLocation &amp;DefaultItemOpen=1&amp;docid=<xsl:value-of select="@DocID" /></xsl:attribute><xsl:value-of select="@Name"/></a>

    Then the docId can be accessed in the form code as e.InputParameters["docId"]

    Finally, once the document is downloaded, obtain an XPathNavigator from the secondary data source for GetDocument and replace main data source's inner XML with the downloaded inner XML.

    For example, if the navigator is called downloadedDocumentNavigator, use this:

    XPathNavigator documentElement = this.MainDataSource.CreateNavigator().SelectSingleNode("/*");
    documentElement.InnerXml = downloadedDocumentNavigator.InnerXml;
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.