problem with .length on a node, doesn't appear to be correct in edit vs. new - InfoPath Dev
in

InfoPath Dev

problem with .length on a node, doesn't appear to be correct in edit vs. new

Last post 02-25-2008 04:42 PM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-22-2008 09:21 AM

    • Mario
    • Not Ranked
    • Joined on 11-04-2005
    • Posts 15

    problem with .length on a node, doesn't appear to be correct in edit vs. new

    hi all, I have an Infopath 2003 form using VB Script.

     I have a couple of repeating tables on the form that are submitted to a database and saved on a Sharepoint form.  when I first fill out the form and save it, it works correctly.  When I come back to edit in through infopath, the .length of the node of the repeating table appears to be too big.  here is the code:

    NumMaterialRowsWidth = XDocument.DOM.SelectNodes("//d:UT_Proposal_Material").length

    If there are only two materials in my database and on the form, the .length parameter is returning 4 and if there are 3, it sometimes returns 5 or 6.

    can any one see any glaring problems with my logic?, I've verified the database and there should be only 2 rows when the .length says 4?

     Any help appreciated, this is a great site with helpful insights.

  • 02-22-2008 12:06 PM In reply to

    Re: problem with .length on a node, doesn't appear to be correct in edit vs. new

    It could be your XPath. You are using "//" which says to return all descendant D:UT_Proposal_Material nodes. This might be picking up nodes that you weren't expecting. Try giving a more direct XPath that includes all the ancestor nodes to this one.

    The other trick is to create a new temporary table in your view to see what is really being returned. Maybe there really is extra rows being returned.

  • 02-22-2008 01:53 PM In reply to

    • Mario
    • Not Ranked
    • Joined on 11-04-2005
    • Posts 15

    Re: problem with .length on a node, doesn't appear to be correct in edit vs. new

    Greg, thanks for the tips, could you give an example of the syntax on  a more direct Xpath or

    point me in the direction of some vbscript examples?

     

    thanks in advance.

  • 02-25-2008 04:42 PM In reply to

    Re: problem with .length on a node, doesn't appear to be correct in edit vs. new

    Try using a complete XPath from the root to the desired node:

    ("/RootNode/GrandParentNode/ParentNode/d:UT_Proposal_Material")

    . . . or whatever the actual full XPath is to that particular node... you should get the idea from here.

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