Calculating a score from question answers (yes, no or n/a) - InfoPath Dev
in

InfoPath Dev

Calculating a score from question answers (yes, no or n/a)

Last post 03-19-2009 09:15 AM by Alec Pojidaev. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-19-2009 08:27 AM

    Calculating a score from question answers (yes, no or n/a)

    We have a form with numerous questions. All of the questions have yes or no type answers but some of them are not applicable and the user should be able to identify them as such. I am currently using a option field with 3 values, 1, 0, -1 for the questions with n/a as a valid choice, but we are having problems getting the logic to sum up the results properly. For example, there are 10 questions, I need to know how many were identified as n/a, subtract this from the total, and then determine how many of the applicable questions were answered yes and how many were answered no. Any suggestions on how to write the expression to do this would be greatly appreciated.

    Thanks

    dean

    Dean
    Charlotte, NC
    Filed under:
  • 03-19-2009 09:12 AM In reply to

    Re: Calculating a score from question answers (yes, no or n/a)

    Essentially the formula would be something like this:

    Number of Yes answers:

    count(/my:myFields/my:questions/my:question[my:answer = 1])

    No answers:

    count(/my:myFields/my:questions/my:question[my:answer = 0])

    N/A answers

    count(/my:myFields/my:questions/my:question[my:answer = -1])

    Of course, the actual formula will be different depending on the structure of your data source and what values you have assigned to Yes, No and N/A

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 03-19-2009 09:15 AM In reply to

    Re: Calculating a score from question answers (yes, no or n/a)

    Here is how to calculate number of the results are equal -1

    string-length(eval(eval(YourRepeatingGroup, 'substring-after(../YourScorefield = -1, "u")'), ".."))

    replacing -1 by other values will get you all range of sums.

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