Find and compare values from a repating table from secondary source? - InfoPath Dev
in

InfoPath Dev

Find and compare values from a repating table from secondary source?

Last post 10-19-2010 04:29 AM by WannabeSharePointGuru. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 10-19-2010 02:57 AM

    Find and compare values from a repating table from secondary source?

    Hi all

    I am trying to loop through a repeating table, which is a secondary data source, and compare the Title column from the repeating table to another string which is not from the table. If they equal, I want all other rows to be hidden, except the equal one. Under you can see in code what I have tried to do, but the problem is that it returns 0 on rows.count, so, I basically never get to itterate at all.

     

    // Retrieve the rows of the repeating table
    XPathNavigator root = MainDataSource.CreateNavigator();
    
    XPathNodeIterator rows = root.Select("/dfs:myFields/dfs:dataFields/dfs:Form_Workflow_Tasks", NamespaceManager);
    
    // Loop through the rows of the repeating table
    
    int counter = 1;
    while (rows.MoveNext())
    {
    // Retrieve the title
    string title = rows.Current.SelectSingleNode("/dfs:myFields/dfs:dataFields/dfs:Form_Workflow_Tasks", NamespaceManager).Value;
    
    // Increment the counter
    counter++;
    }
     
    Is it at all possible to itterate through a repeating table from a secondary data source. Any help is appreciated :)
    Regards
  • 10-19-2010 03:13 AM In reply to

    Re: Find and compare values from a repating table from secondary source?

    Ok. I found it.. (Points for myself :D)

     Insted of this:

    XPathNavigator root = MainDataSource.CreateNavigator();

    I have to do this

    XPathNavigator root = this.DataSources["Name of connection"];

    .. but still I wonder how to show only the relevant row,  and I am looping the wrong way because I only get the first title from the first row allways, so please let me know if you got some tips on how to fix :)

  • 10-19-2010 04:29 AM In reply to

    Re: Find and compare values from a repating table from secondary source?

    Ok. I keep this one man show going :D

    I managed to iterate properly now, and find the titles properly by adding the attribute on the XPathNodeIterator  like this

    XPathNodeIterator rows = root.Select("/dfs:myFields/dfs:dataFields/dfs:Form_Workflow_Tasks/@Title", NamespaceManager);

    Now I only need help to hide the irrelevant rows in the repeating table. So, please help me with that :)

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