Boolean statements -- very basic question - InfoPath Dev
in

InfoPath Dev

Boolean statements -- very basic question

Last post 08-11-2009 03:58 PM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-11-2009 01:36 PM

    • carwil
    • Not Ranked
    • Joined on 08-11-2009
    • Posts 6

    Boolean statements -- very basic question

    I am new to InfoPath, 2-hours new to be exact, and I am wondering how to right a simple boolean statement.  Something must be so obvious I'm missing the point.  A sample of what I am trying to accomlish is this:  If [field1] >12 then [field1]/4 else 0.

    Also, any good recommendations for reference books or tutorials would be greatly appreciated.

    Thanks!!

  • 08-11-2009 03:00 PM In reply to

    Re: Boolean statements -- very basic question

    Hi:

    Is this something you'd want to use in a rule? If so, you set conditions for your rule. Say, for example, you have a field called field2 that you want to set with the value from your if statement. You'd first add a condition for field1 > 12. Your rule would have an action to set field2's value to field1 div 4. Then you'd add another rule, with another condition -- this one would be field1<= 12. The action for this rule would be to set field2's value to 0.

    If what you want is a conditional default value, there is nothing out of the box for that -- there is some XPath magic you can use to create a conditional default, but it can be a little tricky.

    Hilary Stoupa

  • 08-11-2009 03:25 PM In reply to

    • carwil
    • Not Ranked
    • Joined on 08-11-2009
    • Posts 6

    Re: Boolean statements -- very basic question

    Thank you very much Hilary that solved my problem.  Is there a way to further define the output with "case" statements.  For example, if the value = P, then poor, G=Good?

  • 08-11-2009 03:58 PM In reply to

    Re: Boolean statements -- very basic question

    Sadly, the only way to do this is with lots of rules... one with a condition of field = p, set other field to Poor, etc. Expression boxes with conditional formatting can be nice for things like this, if you don't want to store the value 'poor' in a field in your form... you can have an expression box that says 'Poor' and one that says 'Good' then apply conditional formatting to show / hide. I know, I know, an If > Then or Case type of construct would be lovely.... but there isn't one, so we have to get creative!

    Hilary Stoupa

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