InfoPath 2007 Expression must evaluate to a node-set. - InfoPath Dev
in

InfoPath Dev

InfoPath 2007 Expression must evaluate to a node-set.

Last post 07-30-2013 11:51 PM by mattsky. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 07-30-2013 12:23 AM

    InfoPath 2007 Expression must evaluate to a node-set.

    HI All

    Yep im a newbie on this forum so im hoping someone will be able to assist. I have numerous infopath forms feeding into others through data source connections which all sits on sharepoint.

    What the end goal im trying to achieve is select a number of fields (10 in this instance) and find the one with the latest time and have this feeding through into the other forms.

     I already have checks making sure the days match up so this is strictly time orientated at this stage.

     the error im getting is Expression must evaluate to a node-set.

    xdMath:Max(-->concat(substring(../my:BtbsStatementDebitCompletedTime, 12, 2), substring(../my:BtbsStatementDebitCompletedTime, 15, 2)) <--| ../my:BtbsStatementCreditNumber)

    the formula im trying is

    max(concat(substring(BtbsStatementDebitCompletedTime, 12, 2), substring(BtbsStatementDebitCompletedTime, 15, 2)) | BtbsStatementCreditNumber)

    Currently i have extra text boxes doing the concat substring work (this is the field BtbsStatementCreditNumber) but i was looking to get rid of these and have it all contained in the one field for ease of use and management (what im trying in the first agrument -if its called that). The above formula is for only 2 fields but this is just a test when it goes live i need it feeding 10, possibly more in other instances.

     Any help would be appreciated.

     thanks

  • 07-30-2013 07:25 PM In reply to

    Re: InfoPath 2007 Expression must evaluate to a node-set.

    Please give this a try:

    max(eval(BtbsStatementDebitCompletedTime, 'translate(substring(., 12, 5), ":", "")') | BtbsStatementCreditNumber)

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-30-2013 11:51 PM In reply to

    Re: InfoPath 2007 Expression must evaluate to a node-set.

    Thanks Jimmy that works perfectly, have now used on all 10 fields and works a treat!

    I like to understand whats behind some of the formulas to know how to for next time, can you explain a little about what you have done, im not familiar with eval and translate (although i think i get what translate is doing in the formula)

     If its to hard no worries, im still very thankful for the assistance!

     cheers

  • 07-30-2013 11:51 PM In reply to

    Re: InfoPath 2007 Expression must evaluate to a node-set.

    Thanks Jimmy that works perfectly, have now used on all 10 fields and works a treat!

    I like to understand whats behind some of the formulas to know how to for next time, can you explain a little about what you have done, im not familiar with eval and translate (although i think i get what translate is

    Jimmy:

    Please give this a try:

    max(eval(BtbsStatementDebitCompletedTime, 'translate(substring(., 12, 5), ":", "")') | BtbsStatementCreditNumber)

    doing in the formula)

     If its to hard no worries, im still very thankful for the assistance!

     cheers

  • 08-01-2013 10:56 PM In reply to

    Re: InfoPath 2007 Expression must evaluate to a node-set.

    Hi Mattsky,

    So what eval() does is it takes a set of nodes, applies an XPath to each of them, and then returns a new set of nodes with the result(s).

    So in the case of my example, this set is just one node.

    We start with (just using a sample value here):

    <BtbsStatementDebitCompletedTime>2013-08-02T10:23:23</BtbsStatementDebitCompletedTime>

    The XPath formula translate(substring(., 12, 5), ":", "") is applied to this:

    substring(., 12, 5) -> 10:23

    translate("10:23", ":", "") -> 1023

    And then this result is returned as a new set of nodes (in this case, just one node):

    <item>1023</item>

    And this is ready to be used with the | union operator to join with other nodes and use in the max() function.

    As a side note, if there are multiple date fields involved here and you want to apply the same extraction technique to them (get characters 12-16 and remove the colon), then instead of this:

    max(eval(BtbsStatementDebitCompletedTime, 'translate(substring(., 12, 5), ":", "")') | eval(BtbsStatementDebitOtherTime, 'translate(substring(., 12, 5), ":", "")') | BtbsStatementCreditNumber)

    You can do this instead:

    max(eval(BtbsStatementDebitCompletedTime | BtbsStatementDebitOtherTime, 'translate(substring(., 12, 5), ":", "")') | BtbsStatementCreditNumber)

    Since, as mentioned above, eval() can operate on a whole set of nodes.

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

    Re: InfoPath 2007 Expression must evaluate to a node-set.

    Thanks Again Jimmy, i actually understood that and have used the shortened version extensively now-even building them into conditional rules populating other fields!

    Just out of curiosity, i am the only person i know who uses infopath and i cant seem to find the level of detail anywhere, is this classed as technical or more of a beginner formula ? Only info i cand find is real basic but nothing like im doing.

     thanks

  • 08-04-2013 08:54 PM In reply to

    Re: InfoPath 2007 Expression must evaluate to a node-set.

     Hello again,

    Aside from its use in the double eval trick, the eval() function does not seem to get a lot of use, and I would guess that the majority of InfoPath users don't know what it does. So I would classify this as a technical formula on account of the use of eval().

     I'm not sure if it relates to the work you're doing, but we do have a large number of blogs and webinar videos detailing various techniques and I recommend checking them out. And of course, we're always here on the forums to help you with any tricky formulas.

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