copy the value of a field in following occurence - InfoPath Dev
in

InfoPath Dev

copy the value of a field in following occurence

Last post 09-15-2006 02:18 AM by Coita Thierry. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-06-2006 12:12 AM

    copy the value of a field in following occurence

    Hi,

    What I would like to do is copy the value that I have entered in the following sibling element from my reapeating-table. But I have an error when I try to modify the 15th element of this table. That send me the error:
    quote:
    Exception de HRESULT : 0x80043051

    I Have try the two following code that send me the same error at the 15th occurence when I try to remove my xsi:nil attribute:
    [InfoPathEventHandler(MatchPath="/CaseList/Case/Geschaeft/SHAB/SHABnr", EventType=InfoPathEventType.OnAfterChange)]
    public void SHABnr_OnAfterChange(DataDOMEvent e)
    {

    if (e.IsUndoRedo)
    {
    return;
    }
    if (e.Source.nodeType != DOMNodeType.NODE_TEXT)
    {
    return;
    }
    if (e.Site != e.Parent)
    {
    return;
    }
    if ("Insert" != e.Operation)
    {
    return;
    }

    string SHABNr = e.Source.text;
    if (SHABNr != "")
    {
    IXMLDOMNode oRow = e.Source.parentNode.parentNode.parentNode.parentNode;
    IXMLDOMNode oRows = oRow.parentNode;
    IXMLDOMNode oNextRow = oRow.selectSingleNode("following-sibling::Case");

    if (oNextRow != null && oNextRow.selectSingleNode("Geschaeft/SHAB/SHABnr").text != SHABNr)
    {
    oNextRow.selectSingleNode("Geschaeft/SHAB/SHABnr").attributes.removeNamedItem("xsi:nil");
    oNextRow.selectSingleNode("Geschaeft/SHAB/SHABnr").text = SHABNr;
    }

    }
    }

    or with this one:
    [InfoPathEventHandler(MatchPath="/CaseList/Case/Geschaeft/SHAB/Datum", EventType=InfoPathEventType.OnAfterChange)]
    public void SHAB_Datum_OnAfterChange(DataDOMEvent e)
    {

    if (e.IsUndoRedo)
    {
    return;
    }
    if (e.Source.nodeType != DOMNodeType.NODE_TEXT)
    {
    return;
    }
    if (e.Site != e.Parent)
    {
    return;
    }
    if ("Insert" != e.Operation)
    {
    return;
    }

    string SHABDatum = e.Source.text;
    if (SHABDatum != "")
    {
    IXMLDOMNode NextCase = e.Source.parentNode.parentNode.parentNode.parentNode.nextSibling;
    if (NextCase != null && NextCase.selectSingleNode("Geschaeft/SHAB/Datum").text != SHABDatum)
    {
    NextCase.selectSingleNode("Geschaeft/SHAB/Datum").attributes.removeNamedItem("xsi:nil");
    NextCase.selectSingleNode("Geschaeft/SHAB/Datum").text = SHABDatum;

    }
    }

    }

    I think I'm doing anything wrong but I dont understand what!

    The problem that I dont understand is that I have anything in my IXMLDOMNode and the data inner is correct but infoapth cant remove this attribute. Why I dont know. Do you think that can be a bug?

    Any idea?

    Thanks

    Thierry
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 09-11-2006 11:00 PM In reply to

    Re: copy the value of a field in following occurence

    Hi Thierry,

    *Your* French forum has some of the most active threads! I think I need to send you stock in InfoPathDev or something. :)

    Not sure if this will help you, but have you tried:

    if (((IXMLDOMElement)NextCase).getAttribute("xsi:nil") != null)
    ((IXMLDOMElement)NextCase).removeAttribute("xsi:nil");

    Good luck!
    Patrick Halstead
    Project Manager at Qdabra
  • 09-14-2006 10:38 PM In reply to

    Re: copy the value of a field in following occurence

    Hi Patrick,

    Thanks for this comment and for have make this possible, too.

    With your code my problem is not solve because I have no error but only 14 field in my repeating section is filled. So I thin that can be a bug because when I see what I have in my IXMLDOMNode I see my markup with the attribut but Infapth are unable to delete, change or take the value.

    So I will try to find another way with System.Xml!

    Thanks

    Thierry
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 09-15-2006 02:00 AM In reply to

    Re: copy the value of a field in following occurence

    Hmmm. System.XML works now with InfoPath 2007. Do you have the Beta2?
    Patrick Halstead
    Project Manager at Qdabra
  • 09-15-2006 02:18 AM In reply to

    Re: copy the value of a field in following occurence

    yes of course!

    But we plan to launch our solution on 1 november so I don't have time to re-develop my solution in 2007 object model!

    But the user will have 2007 on their pc!

    It's because we have make some testing and see that go very faster our solution on infopath 2007!

    But next year in april we plan to re-develop our solution with the 2007 Object model!

    Other things have you develop somethings for my control? Or you don't have time now.

    Because that can be a great things if we can include this control for the launch of the application!!!

    Thanks

    Thierry
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.