Correct Syntax - InfoPath Dev
in

InfoPath Dev

Correct Syntax

Last post 05-16-2005 07:12 AM by Fast Flare. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-10-2005 06:33 AM

    Correct Syntax

    Here's the problem:

    I have 4 text boxes that need to be averaged, and the result shown in another box. All the text boxes are decimals. I cannot seem to find the right syntax for averaging the four fields. I try using the formula button in the text box property dialog box (with the "avg" function), but I only get a sum of the numbers. Also, when I publish the form, before it's filled out, there is a "NaN" showing in the box.

    Does anyone know the correct syntax for this? Thanks.

    T. Hunt
    www.goisc.com
    www.fastflare.com
  • 05-11-2005 10:05 AM In reply to

    XPath itself doesn't have an avg() function. InfoPath does have an avg() function under XDocument.Util.Math.Avg() but it requires a list. If you have a repeating group, the list is easy to obtain. Otherwise you might be able to get a list by doing a specialized select in XPath such as SelectNodes("field1 | field2 | field3 | field4").

    Another way to do this is not very complex, just brute force... simply add all four fields together and then divide by four:

    (field1 + field2 + field3 + field4) / 4.



    Greg Collins [InfoPath MVP]
    InfoPathDev
  • 05-12-2005 06:44 AM In reply to

    Thanks! Very helpful.....

    T. Hunt
    [email protected]
    www.fastflare.com
  • 05-12-2005 09:26 AM In reply to

    Hi Tracy,
    Cool site! What do you charge for logos?
    :)

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 05-16-2005 07:12 AM In reply to

    Hi Patrick! I'm sending you an email with all the info. Thanks! Tracy

    Hi Tracy,
    Cool site! What do you charge for logos?
    :)

    Patrick Halstead [InfoPath MVP]
    InfoPathDev


    T. Hunt
    [email protected]
    www.fastflare.com
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.