Provide default data within form - InfoPath Dev
in

InfoPath Dev

Provide default data within form

Last post 05-09-2010 01:16 PM by wilfman. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-08-2010 10:12 AM

    Provide default data within form

    Hi,

    I am sure this is really easy but have a template in which I want to populate with default data when it loads (e.g. lookup values, system specifications, etc).    What is the easiest way to do this?  Is this using resource files?  The namespaces will be identical as I will fill in the form with all the information I need and then look to import that xml.

    The form will need to be 2003 compatible.

     Thanks

  • 05-09-2010 10:03 AM In reply to

    Re: Provide default data within form

    Managed to find a way as per below.  May not be the neatest solution but seems to work.   

    //Load Data From Template from the root "myFields" down.

    IXMLDOMNode rootNode = thisXDocument.DOM.selectSingleNode("//*[local-name()='myFields']");

    IXMLDOMNode newNode = thisXDocument.GetDOM("Lookups").selectSingleNode("//*[local-name()='myFields']");

    //Check number of entries in the Lkup_1-10 field

    IXMLDOMNodeList myNodes = thisXDocument.DOM.selectNodes("//*[local-name()='Lkup_1-10']");

    int myNodesLength = myNodes.length;

    //If the field only contains one entry, the default data has never been loaded. Therefore.

    if (myNodesLength < 2)

    {

    //Write all data in the form

    rootNode.parentNode.replaceChild(newNode, rootNode);

    }

  • 05-09-2010 11:43 AM In reply to

    Re: Provide default data within form

     You could just use the Default Values... dialog box provided under the Tools menu in the InfoPath designer.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-09-2010 01:16 PM In reply to

    Re: Provide default data within form

    Thanks....  Tried that but, unless I am doing something wrong, they will not import mulitple rows.  Unfortunatley a lot of the data is in repeating tables which I need to filter so have to import it into the primary source instead of leaving it in the resource files.

     

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