Getting the current row and "XsltContext is needed for this query because of an unknown function" - InfoPath Dev
in

InfoPath Dev

Getting the current row and "XsltContext is needed for this query because of an unknown function"

Last post 12-08-2009 05:03 PM by Jimmy. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 12-08-2009 01:56 AM

    • laflour
    • Not Ranked
    • Joined on 12-08-2009
    • Sydney
    • Posts 6

    Getting the current row and "XsltContext is needed for this query because of an unknown function"

    I'm trying to get the current row in the repeating table programmatically, to update the rows' elements for InfoPath 2007 To do this I'm using the following code: MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:timesheetEntries/my:item/my:project[current()]", NamespaceManager).SetValue(firstItemName); This will select the current element and set the value. But, I get the following error "XsltContext is needed for this query because of an unknown function" The issue in "current()" statement. I tried to google but from all posts I seen there are no workarounds how to make it working.
  • 12-08-2009 03:48 AM In reply to

    Re: Getting the current row and "XsltContext is needed for this query because of an unknown function"

     The current() function can't be used in code like this, and there is no concept of a "current" row when you're accessing the XML from code.  What would you expect current() to indicate in this situation?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-08-2009 04:02 AM In reply to

    • laflour
    • Not Ranked
    • Joined on 12-08-2009
    • Sydney
    • Posts 6

    Re: Getting the current row and "XsltContext is needed for this query because of an unknown function"

    I would expect that current() returns me the row where I operate. If it can't be used in this content, what is the solution to access the elements in the nearby column for the current row?!
  • 12-08-2009 07:15 AM In reply to

    Re: Getting the current row and "XsltContext is needed for this query because of an unknown function"

    One of the properties of the event object (eventObj.Source, or something along those lines) should give you a reference to the node or row where the event occurred.  From there you can use relative XPath to get at the node you want.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-08-2009 01:49 PM In reply to

    • laflour
    • Not Ranked
    • Joined on 12-08-2009
    • Sydney
    • Posts 6

    Re: Getting the current row and "XsltContext is needed for this query because of an unknown function"

    It gives the reference to the current row, right, but not to the DataSource of the actual controls in this row :( And I have not idea how to access the control's items for the row

    For example, I'm using item_changed event, that is fired when we add/remove new row in repeating table. One of the parameters provide access to the XmlNavigation elements of the current row, so I'm using e.Site.SelectSingleNode("my:sections", NamespaceManager) to read the selected value from that control.

    But how to access the actual control to populate its values?! Somehow I need to get the access to the DataSource of control in the curren row. *_change events don't provide the access to dataSourcea

  • 12-08-2009 04:46 PM In reply to

    Re: Getting the current row and "XsltContext is needed for this query because of an unknown function"

     You can't access controls directly.  The only way to modify InfoPath data in code is to use the variety of XML manipulation methods made available by XPathNavigator.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-08-2009 04:48 PM In reply to

    • laflour
    • Not Ranked
    • Joined on 12-08-2009
    • Sydney
    • Posts 6

    Re: Getting the current row and "XsltContext is needed for this query because of an unknown function"

    Any samples/guidelines how to achieve this?!
  • 12-08-2009 05:03 PM In reply to

    Re: Getting the current row and "XsltContext is needed for this query because of an unknown function"

     http://msdn.microsoft.com/en-us/library/bb509311.aspx#InfoPath2007XPathNavigatorClassFormTemplates_WorkingWithCurrentNode

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.