why my secondary datasource loose entry? - InfoPath Dev
in

InfoPath Dev

why my secondary datasource loose entry?

Last post 11-10-2005 01:41 AM by Coita Thierry. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-09-2005 07:54 AM

    why my secondary datasource loose entry?

    Hi,

    A very strange things is happen to my form.

    I have one view with one secondary datasource.

    I have a dropdown listbox that is link to my secondary datafield

    value : ID
    Display: Text

    If I select a text on my listebox I have a one afterchangeevent:
    if (e.IsUndoRedo)
    {return;}
    if (e.Source.nodeType != DOMNodeType.NODE_TEXT)
    {return;}
    if(e.Site != e.Parent)
    {return;}
    if ("Insert"!= e.Operation)
    {return;}
    IXMLDOMNode Old = thisXDocument.DOM.selectSingleNode("/Essai/Muster");
    string essai = thisXDocument.DOM.selectSingleNode("/Essai/Choice").text;
    string condition = "/Essai/Muster[@id='"+ essai + "']";
    IXMLDOMDocument2 oDomSearchHRG = (IXMLDOMDocument2)thisXDocument.GetDOM("muster");
    IXMLDOMNode New = oDomSearchHRG.selectSingleNode(condition);
    Old.parentNode.replaceChild(New, Old);


    and in the return I have the id displayed in the listebox and not text! If I select another item in my listebox the previous is nomore here! If I select all the item of the listebox one by one in the end I have nothing in my listebox!

    I can send you the form if you don't understand or you wan't to see! send me a mail!

    I think the problem is when I do the replace node! but why he erase New from the secondary datasource?

    Any idea?

    Thanks a lot for your comments!

    ++

    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 11-09-2005 09:59 AM In reply to

    Re: why my secondary datasource loose entry?

    Salut Thierry,

    Why are you trying to overwrite a node in your main DOM by a node from your Secondary DOM. Have you tried to read the info from your secondary DOM and just set value within your main DOM? In addition, this way, it would be easier to debug as you could step through values before applying them to your DOM.

    Am I missing something here?

    Franck
  • 11-10-2005 01:41 AM In reply to

    Re: why my secondary datasource loose entry?

    Salut Franck,

    J'ai eu de la peine à comprendre ou tu voulais en venir mais je crois que j'y suis arrivé!

    Thanks for your reply! so like you say I have modify my code :
    IXMLDOMNode Old = thisXDocument.DOM.selectSingleNode("/Essai/Muster");
    string essai = thisXDocument.DOM.selectSingleNode("/Essai/Choice").text;
    string condition = "/Essai/Muster[@id='"+ essai + "']";
    IXMLDOMDocument2 oDomSearchHRG = (IXMLDOMDocument2)thisXDocument.GetDOM("muster");
    string Newdata = oDomSearchHRG.selectSingleNode(condition).xml;

    IXMLDOMDocument2 toto = (IXMLDOMDocument2)thisXDocument.CreateDOM();
    toto.loadXML(Newdata);
    Old.parentNode.replaceChild(toto.selectSingleNode("/Muster"), Old);


    That work great now!

    In your meaning :
    Is it my code good or I can make some improvement?

    Thanks

    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.