Using a Checkbox in a calculation? - InfoPath Dev
in

InfoPath Dev

Using a Checkbox in a calculation?

Last post 06-15-2009 04:27 PM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-15-2009 04:02 PM

    • djj66
    • Not Ranked
    • Joined on 05-27-2009
    • Posts 13

    Using a Checkbox in a calculation?

    Hi everyone,

    Does anyone know how to use the value from a checkbox on an InfoPath form as either 1 or 0 (ie True = 1, False = 0)

    I'm trying to do this in a repeating table, where the user will type in a value (eg an invoice amount) and then to the right of that set the check box = true if VAT should be added, or False if VAT is not applicable.  That part is easy.  But at the bottom of the table I want to do a sum, something like sum(@InvoiceAmount * @ApplyVAT)   (ie to sum all the values where VAT should be added)

     In my example here @invoiceamount is a decimal, and @ApplyVAT is a checkbox. My sum doesn't work at the moment, because InfoPath doesn't treat Checkboxes as 1 or 0

    I've tried various functions, such as EVAL, Boolean, but can't get this working.

    If I need code, I'm using VBScript in InfoPath 2003.

    Many thanks in advance,

    David

     

  • 06-15-2009 04:27 PM In reply to

    Re: Using a Checkbox in a calculation?

    Try putting @ApplyVAT into another set of parenthesis. I know for conditional defaults when I want a boolean expression to evaluate to 1 or 0, I have to use more parenthesis. So, like:

    sum(@InvoiceAmount * (@ApplyVAT)) 

    Hilary Stoupa

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