Infopath - InfoPath Dev
in

InfoPath Dev

Infopath

Last post 11-04-2008 02:38 AM by Hari Krishna. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 11-03-2008 07:04 AM

    Infopath

     I just need an Auto number created in my InfoPath form which then can be submitted into SQL. I do not have any repeating table.Can someone help me?

     

  • 11-04-2008 02:03 AM In reply to

    Hi,

     You can generate an auto number by using this code:

     thisXDocument.DOM.selectSingleNode("/my:myFields/my:field1") = Guid.NewGuid().ToString();

    Here field1 is the field in which autonumber is stored.

  • 11-04-2008 02:15 AM In reply to

    Many thanks for your reply. 

    But where do I type this code.

    Sorry I am not sure. I am new to Infopath.

     

  • 11-04-2008 02:38 AM In reply to

    Hi,

    Paste this code in fields on after change event to the field which you want to generate autonumber.

     public void field1_OnAfterChange(DataDOMEvent e)

    {

    if (e.IsUndoRedo | isNull)

    {

    return;

    }

    if (e.Site.text == "")

    {

    isNull =
    true;

    thisXDocument.DOM.selectSingleNode("/my:myFields/my:field1") = Guid.NewGuid().ToString();

    isNull = false;

    }

    }

     

     Do remember to declare isNull variable:

    private bool isNull = false;

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