Store Data for Offline Use - InfoPath Dev
in

InfoPath Dev

Store Data for Offline Use

Last post 04-04-2007 10:50 AM by BanGotti. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 12-01-2006 01:36 PM

    Store Data for Offline Use

    Currently I have a form where I collect data from an sql call and populate a bunch of drop-downs. The issue is that when I take the form offline, the drop-downs don't populate because I don't have access to the database. Hence, I'm trying to figure out how to store the data retrieved in the background xml file. Is this possible? Does anyone have a good example of this? Thanks!
  • 12-01-2006 09:32 PM In reply to

    Re: Store Data for Offline Use

    Hi mschmit,
    Go through this thread, hope it helps you!
    http://infopathdev.com/howto/tutorials/default.aspx?i=3b9d4d677daf4ef18d8e93d0cd188194
    Shilpa
    INFOPATHDEV India
  • 03-15-2007 12:15 PM In reply to

    Re: Store Data for Offline Use

    This code works great except when I have a field that is blank in my SharePoint List. (i.e. Address 2, Address 3, etc.) I get the following error:

    TypeError: -2146827864: Object Required

    Can anyone help please?
  • 04-04-2007 10:50 AM In reply to

    Re: Store Data for Offline Use

    Hello,

    I have used the code of the how to:

    Allow Offline Use of a SharePoint List by Caching Locally

    But I have a problem, when I disconnect my computer, my form uses the same data than the in the first xml file. But when I reconnect it, I have the updated data.

    However, logiccaly, when offline, I should see the latest updated data. But it does not, any idea why?

    Here is the code (which is the same actually, than in the how to):

    try{
    // Avoid DOM updates when the document has been digitally signed.
    XDocument.DataObjects["MQuestDataIn"].Query();

    // Get the ShareList DOM
     var oDataIn = XDocument.GetDOM("MQuestDataIn" );
     
    // Setup the Namespaces  
    oDataIn.setProperty("SelectionNamespaces",'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://tempuri.org/"' );
    // Get the local DOM - to does not use namespaces

    var oLocalDom = XDocument.GetDOM( "Local Productys" );


    // Get a sample cached list node that we will need to clone later
      var nSampleProductNode = oLocalDom.selectSingleNode( "/CachedList/Products/Product");


    // Remove all of the items from the local copy of the list
    oLocalDom.selectNodes( "/CachedList/Products/Product" ).removeAll();

    // Loop through all of the items in the Web Service List
    var nlSharedItems = oDataIn.selectNodes( "/dfs:myFields/dfs:dataFields/tns:MQuestDataInResponse/tns:MQuestDataInResult/OdsChaudiaires/chaudiaires" );

    while( (nSharedItem = nlSharedItems.nextNode() ) != null )   
    {       
    // Create a new row from the sample       
    var nNewLocalCacheRow = nSampleProductNode.cloneNode(true);

      // Set the values      
    nNewLocalCacheRow.selectSingleNode( "@ID" ).text = nSharedItem.selectSingleNode( "IDTYPECHAUDIAIRE" ).text;       
    nNewLocalCacheRow.selectSingleNode( "@Name" ).text = nSharedItem.selectSingleNode( "NOMCOMBUSTIBLE" ).text;      
    nNewLocalCacheRow.selectSingleNode( "@Description" ).text = nSharedItem.selectSingleNode( "NOMCOMBUSTIBLE" ).text;

      // Append to to our local cached list
      oLocalDom.selectSingleNode( "/CachedList/Products" ).appendChild( nNewLocalCacheRow );  

    }
    }
    catch(e)
    {  

    // Uncomment this line for more debug information   
    //XDocument.UI.Alert( e.description );
    // Tell the user that they must be connected to the Internet to use this feature.   
    XDocument.UI.Alert( "Vous devez être connecté pour avoir la version updatée des données.");
    }



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