Run a code only once to add the data from the secondary data source to main data source - InfoPath Dev
in

InfoPath Dev

Run a code only once to add the data from the secondary data source to main data source

Last post 08-20-2009 08:22 AM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-19-2009 03:41 AM

    Run a code only once to add the data from the secondary data source to main data source

     Hello All,

    This forum has been indispensable in learning infopath. I am trying to submit form to a SharePoint library which has a fields which has data coming from sharepoint list ( I am using repeating section to get those data) and check box next to it if the service is available in the chosen branch or not.

    The problem I am facing is that I wrote the code at onload event to copy the main data source to the secondary data source and dispaly it in the repeating section is every time the form is opened to edit a new section is added at the end with a new copy of the list items from the list library. How can I avoid that.

     Also I want to have the same contents as there in the list library i.e. I want the repeating section to be in sync witht the list items any changes in the list library should be updated in the form...

     Any hints in regards this will be of real help...thanks in advance.

    ---
    Deepak N Naidu
    "Giant Leap Starts With One Small Step"
    http://deepakn.info/blog
  • 04-19-2009 05:52 AM In reply to

    Re: Run a code only once to add the data from the secondary data source to main data source

    Oops Didnt see the form instance new options...

    I used the code to check if the form is a new or not...

     

    ---
    Deepak N Naidu
    "Giant Leap Starts With One Small Step"
    http://deepakn.info/blog
  • 08-20-2009 04:34 AM In reply to

    Re: Run a code only once to add the data from the secondary data source to main data source

    Hi, this sounds like the exact same problem I'm having. Could you (or anybody else) elaborate on how you solved it?

  • 08-20-2009 08:22 AM In reply to

    Re: Run a code only once to add the data from the secondary data source to main data source

    Hi:

    You can find out if a form is new by using the following:

    C#, IP 2003:

    bool newForm = thisXDocument.IsNew;

    C#, IP 2007:

    bool newForm = this.New;

    The newForm variable will be true if the form is new, false if it isn't. Of course, if the 'newness' of the form isn't the deciding factor as to whether to run your code, you may need to have a field in your form that you use to help you decide the right time to run your code...

    Hilary Stoupa

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