Calculating fields to add up to a set percentage; how do you add the % symbol - InfoPath Dev
in

InfoPath Dev

Calculating fields to add up to a set percentage; how do you add the % symbol

Last post 11-24-2014 04:04 AM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-18-2014 11:03 AM

    • shamisty
    • Not Ranked
      Female
    • Joined on 02-22-2013
    • Austin, Tx
    • Posts 25

    Calculating fields to add up to a set percentage; how do you add the % symbol

    Ok, I know how to add the fields together to get a total, I also know how to get it to be a percentage, my question is............... How can I make my "total" field set to 100%, or as the previous fields are being entered, that the "total" field is being calculated, but it cannot exceed 100%??? Also, how in the heck do I get the % symbol to show in my fields? Please help!
    Misty
    aMUSEr, Star Trekie, Full time Nerd.
    My other full time job - Dr, booboo kisser, tear wiper, booty wiper, chef, bather, milker, diaper changer, dish washer, clothes washer, monster ninja, hug giver, kiss giver, story teller, etc = MOM
  • 11-24-2014 04:04 AM In reply to

    Re: Calculating fields to add up to a set percentage; how do you add the % symbol

    Hi Misty,

    Thanks for posting. You can use some complex XPaths to do this... here are some examples:

    • Repeating sections (example)

      • Total Percent Completed: 
        (TotalAnsweredTest / TotalQuestionsTest) * 100

      • TotalAnsweredTest: sum(AnsweredYN)

      • TotalQuestionsTest: count(AnsweredYN)

    • Independent fields (example 2)

      • Total:
        count(field1 | field2 | field3 | field4 | field5 | field6 | field7 | field8 | field9 | field10)

      • Percent:
        100 - (100 * count(field1[. = ""] | field2[. = ""] | field3[. = ""] | field4[. = ""] | field5[. = ""] | field6[. = ""] | field7[. = ""] | field8[. = ""] | field9[. = ""] | field10[. = ""])) / Total

    • More advanced – use calculated values (no additional fields req’d)

      • All fields: count((//*[not(*)] | //@*)[not(name() = "xml:lang")])

      • Filled in: count((//*[not(*)] | //@*)[not(name() = "xml:lang")][. != ''])

    To get the % symbol to show up, don't worry about putting it in the field. Just type it in after the field. 

    Please let us know if you have any other questions!

    :) 

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.