Setting a Boolean Value - InfoPath Dev
in

InfoPath Dev

Setting a Boolean Value

Last post 11-27-2007 09:11 AM by GLazkano. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-24-2006 06:25 AM

    Setting a Boolean Value

    Greetings!

    In my form's data source, I have True/False (boolean) value that is not displayed on my form. I would like to know if it's possible via VBScript or JScript (perhaps in a button's onClick handler) to set this value to either TRUE or FALSE. I know that it's possible to set the text of a value on a form via something like:


    Dim txtFullName : Set txtFullName = XDocument.DOM.selectSingleNode("//my:Full_Name")
    txtFullName.text = "John Q. Public"


    But I haven't been able to find a way to set a boolean value, and especially one that's not displayed on the form itself. Thanks in advance.


    Herb
  • 10-24-2006 12:49 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Setting a Boolean Value

    Hi Herb Welcome to the Forums,

    You probably need to remove the xsi:nil attribute. Here is the code:

    IXMLDOMNode FullNameNode = thisXDocument.DOM.selectSingleNode("//my: Full_Name");
    removeNil(FullNameNode).text = "true";

    public IXMLDOMNode removeNil(IXMLDOMNode node)
    {
    //Determine whether the xsi:nil attribute is set for this
    //element. If so, remove the xsi:nil attributes so that
    //the value can be set.
    if (node.selectSingleNode( "@xsi:nil" ) != null)
    node.selectSingleNode( "@xsi:nil" ).text = "false";

    // return the node for convenience
    return node;
    }
  • 10-26-2006 08:01 AM In reply to

    Re: Setting a Boolean Value

    Hi Shiva! Thanks for you reply - it did the trick :)
  • 11-27-2007 09:11 AM In reply to

    • GLazkano
    • Top 200 Contributor
      Female
    • Joined on 07-05-2007
    • Basque Country
    • Posts 54

    Re: Setting a Boolean Value

     Hi,

    can that be done in jscript? I'm trying with:

     var vartrue = true;
     var listafacturar = XDocument.DOM.selectNodes( "/inv:invoice//my:Control_Obra//my:Capa_Exterior_Obra//my:Capa_Intermedia_Obra//my:Capa_Interior_Obra//my:Facturado[ ../my:Facturar = '" + vartrue + "' ]" );

        while( (probando = listafacturar.nextNode()) != null )

        {
            probando = vartrue;
        }

     

    But my:Facturado doesn't change for the selected nodes. What's the problem? 

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