Hi,
What I try to make is a selectsinglenode with a condition in a secondary datasource.
Hier is my code:
[InfoPathEventHandler(MatchPath="/AV/AVel/M/choix", EventType=InfoPathEventType.OnAfterChange)]
public void choix_OnAfterChange(DataDOMEvent e)
{
//sélection du muster pour le remplissage
if (e.IsUndoRedo)
{
return;}
if (e.Source.nodeType != DOMNodeType.NODE_TEXT)
{
return;}
if(e.Site != e.Parent)
{
return;}
if ("Insert" != e.Operation)
{
return;}
//Sélection du noeud a remplacer et récup de l'id
IXMLDOMNode Old = e.Source.parentNode.parentNode.selectSingleNode("Muster");
string Choicetext = e.Source.text;
string condition = "/dfs:myFields/dfs:dataFields/tns:getMusterParamsResponse/tns:getMusterParamsResult/tabMuster/Modele[Des = '" + Choicetext + "']/Muster";
//Recherche du bon modele a l'aide de l'id
IXMLDOMDocument2 oDomSearch = (IXMLDOMDocument2)thisXDocument.GetDOM("getMusterParams");
oDomSearch.setProperty("SelectionNamespaces", "xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"
xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:tns=\"http://zefix.powernet.ch/WebServices\"");
IXMLDOMNode New = oDomSearch.selectSingleNode(condition);
Choice is a dropdown listebox populate by the same datasource so infopath must find this entry!
The problem is that this listebox is in a repeating section and if it's not the first occurence(if first occurence that always work) that dont work anymore: new is null (for all entry)!
my XPath (string condition) for example is: "/dfs:myFields/dfs:dataFields/tns:getMusterParamsResponse/tns:getMusterParamsResult/tabMuster/Modele[Des = 'Bes. befähigter Revisor, Hinterlegung Unterlagen']/Muster" and that send null (I have seen in the secondary ds he is present)
Any idea about what is going wrong?
I'm totally lost!
Thierry
Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
merci de lire ceci