Problem retrieving data - InfoPath Dev
in

InfoPath Dev

Problem retrieving data

Last post 11-21-2007 03:13 AM by GLazkano. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-19-2007 12:47 AM

    • GLazkano
    • Top 200 Contributor
      Female
    • Joined on 07-05-2007
    • Basque Country
    • Posts 54

    Problem retrieving data

    Hi,

    in an Infopath 2007 form, I have the following error:

    Error - A floating attribute may not be passed as the context node for an XSLT transform or an XPath query.

    That's on the 1273 row, and in that row the code is:

     
    var cantidadmaxima = eventObj.Source.selectSingleNode("my:cantidadmaxima");

    It's the first line in a OnAfterChange function, and it fails if I try to retrieve any field. I also tried with another fields and with fields retrieved in another function, and it neither worked. 

     

    So the question is... WTF? Why isn't it working? 

     

    Thanks 


     

  • 11-19-2007 07:19 AM In reply to

    Re: Problem retrieving data

    What is the field type for my:cantidadmaxima? Decimal?

    I would look at changing this or having another string value field which is used to pass the number in and out of code.

  • 11-19-2007 07:30 AM In reply to

    • GLazkano
    • Top 200 Contributor
      Female
    • Joined on 07-05-2007
    • Basque Country
    • Posts 54

    Re: Problem retrieving data

     Hi,

    my:cantidadmaxima is a double field. Should I change it to another type?

    I tried changing it to string, but nothing changes

     

    Thanks. 

  • 11-19-2007 07:38 AM In reply to

    Re: Problem retrieving data

    Have you tried explicitly setting your cantidadmaxima field?

    You may look at using a string field that is empty. The trick is figuring out which side of the equation is causing the problem.

  • 11-19-2007 07:48 AM In reply to

    • GLazkano
    • Top 200 Contributor
      Female
    • Joined on 07-05-2007
    • Basque Country
    • Posts 54

    Re: Problem retrieving data

    Hi,

    I think I don't understand what you've said. Did you mean I should try to retrieve an empty string field?

     

    I've tried it with an empty string field and it neither works: the same error. But the most strange is that if I copy another field retrieving that works in other function, it neither works. I can't understand it...

     

    Thanks. 

  • 11-20-2007 08:45 AM In reply to

    Re: Problem retrieving data

    I'd have to see the schema to be sure, but from the error message it seems like the problem is that "eventObj.Source" resolves to an attribute node, and you cannot call selectSingleNode() from these objects.

     What node is your OnAfterChange event firing for?  If it is the attribute node, you should change it to fire on the parent node.  If it is the parent node, then you should use eventObj.Site, which will always resolve to the node that is stated in the name of the method.  Then, you can reliably surf to different nodes from that.  If your OnAfterChange event is firing on a node that has children, then eventObj.Source will change with each firing, depending on where the change was detected, while eventObj.Site will always stay the same.

     Hope this helps!  Please reply with more context if you need more help.

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 11-21-2007 03:13 AM In reply to

    • GLazkano
    • Top 200 Contributor
      Female
    • Joined on 07-05-2007
    • Basque Country
    • Posts 54

    Re: Problem retrieving data

     Hi,

    I think it will be easier if I explain it with images, so let's go:

     

     Data source

     

     The red box is the field with the OnAfterChange event (Matt, is the same that the product problem, but is another requirement of our client). The blue box is the field I want to retrieve and modify. The datasources are coloured as the fields.

     

    Is this enough to understand the problem?

     

    Thanks. 

     


    PS: If I change the eventObj.Source for eventObj.Site, it doesn't fail in the retrieving, but it does when I try to modify the retrieved field. 

     

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