Populate query fields from secondary DS - InfoPath Dev
in

InfoPath Dev

Populate query fields from secondary DS

Last post 07-10-2005 11:31 PM by Coita Thierry. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-07-2005 08:00 AM

    Populate query fields from secondary DS

    Hi,

    Sorry for all this question but it's the last for today!

    I wan't that in the on load event infopath put me some value in the query fields of one of my datasource.

    In C# i make this:

    thisXDocument.GetDOM("searchHRG").selectSingleNode("/dfs:myFields/dfs:queryFields/ns2:searchHRG/ns2:Amt").text="150";


    But that make me an error :

    quote:
    System.Runtime.InteropServices.COMException
    Reference to undeclared namespace prefix: 'dfs'.


    I don't understand because it's define at the beginning of the public class of my infopath?

    I have to declare it one more time but where?

    Thanks a lot one more times for your help it's very appreciate!

    ++

    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
  • 07-08-2005 06:33 AM In reply to

    Re: Populate query fields from secondary DS

    Hi.

    Not really an answer to your namespace error. But does this XPath work?
    thisXDocument.GetDOM("searchHRG").selectSingleNode("//*[local-name()=Amt]").text = "150";

    Cheers. Scott.
  • 07-10-2005 12:31 PM In reply to

    Re: Populate query fields from secondary DS

    Hi Thiery,
    You need to set selectionNamespaces property for this dataconnection before calling the connection for selecting the node with an xpath. You can set property this way
    IXMLDOMDocument2 oDomSearchHRG = (IXMLDOMDocument2)thisXDocument.GetDOM("searchHRG");
    oDomSearchHRG.setProperty("SelectionNamespaces", "xmlns:my=\"http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-02-03T00:56:51\" xmlns:s0=\"http://tempuri.org/\" xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:mime=\"http://schemas.xmlsoap.org/wsdl/mime/\" xmlns:tm=\"http://microsoft.com/wsdl/mime/textMatching/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:http=\"http://schemas.xmlsoap.org/wsdl/http/\" xmlns:ns2=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:xd=\"http://schemas.microsoft.com/office/infopath/2003\"");

    oDomSearchHRG.selectSingleNode("/dfs:myFields/dfs:queryFields/ns2:searchHRG/ns2:Amt").text="150";

    Agni
    InfoPathDev India
  • 07-10-2005 11:31 PM In reply to

    Re: Populate query fields from secondary DS

    Hi Agni,

    Thanks a lot for your answer It work great!

    The only things to make for that work is replace the namespacea by your namespaces!

    ++

    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 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.