Reading Yes/No as boolean?

Reading Yes/No as boolean?

GTisRuleX
Advocate Advocate
9,725 Views
7 Replies
Message 1 of 8

Reading Yes/No as boolean?

GTisRuleX
Advocate
Advocate

Reading in the help file, it says I can use a YES/NO in an IF statement.  However, no matter what I try I can't get it to evaluate the formula.

 

the attached screenshot errors with an "Improper use of Boolean"

bolts.jpg

The real IF statement I want here though is this;

Bolt Kit Qty is set to "INTERGER"

 

IF(AND (Bolts End 1 = 1, Bolts End 2 = 1), Bolt Kit Qty = 2, Bolt Kit Qty = 1)

 

Anyone have any idea of why these won't evaluate?  I've tried TRUE, YES, 1, and none seem valid.

 

0 Likes
Accepted solutions (1)
9,726 Views
7 Replies
Replies (7)
Message 2 of 8

SteveKStafford
Mentor
Mentor

You want to change the number of bolts according to the check boxes? The formula needs to be in that parameters formula colum.

 

Yes/No parameters are assumed to be true so their syntax is a bit simpler than might be expected. In the image it looks like this:

 

Bolt Kit Qty = if(Bolts End 1, 1,2)

 

In plain english format: if Bolts End 1 is true use 1 if false use 2. There is no equal statement required, just the true and false values to use.


Steve Stafford
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
EESignature

0 Likes
Message 3 of 8

Secttor
Collaborator
Collaborator
Hi
I don't see your goal from your sentence but I can imagine that :
1. Bold End 1 to be active : if(Bold Kit City =1,1=1,1=0)
1. Bold End 2 to be active : if(Bold Kit City =2,1=1,1=0)

"if(and(..." must be used for 2 conditions inside the formula.
Revit MEP - Electrical Certified Professional
Revit MEP - Mechanical Certified Professional

Draftworks.wordpress.com
0 Likes
Message 4 of 8

GTisRuleX
Advocate
Advocate

In short if end 1 is checked on, I want our QTY total to be 1, if end 2 is checked on, QTY total should be 1, but if both check boxes are on, the QTY should be 2.

 

Essentially it's a clip that holds down cable tray to strut.  We have a single version that can be slapped anywhere, but I've also built a combined version that you can drop on the center of the tray, and set width for the tray, then toggle on or off which end, or possibly both ends that need the bolt kits.  We want to be able to schedule for a QTY total.

 

I currently have the check boxes being pushed to a schedule to gather a total, but I think it would be much more streamlined if it was simply a number that can be totalled in the end.  Currently I need two parameters to control End 1 from End 2, and in the "Assembled" version of the part I need to make sure the count shows a total of 2 instead of 1 per "assembly".

Since both have been built as a shared parameter, it's working as intended with the checks, but I still want numbers as it doesn't provide a "Total" of true values.

bolts2.jpg

0 Likes
Message 5 of 8

jdiala
Advocate
Advocate

Put this formula under Bolt Kit Qty. parameter.

 

if(and(Bolt End 1, Bolt End 2), 2, 1)

but this doesn't account if there is no check on both boxes. If both are uncheck, the value is 1. Do you want this to be zero?

0 Likes
Message 6 of 8

SteveKStafford
Mentor
Mentor
Accepted solution

The attached image will use 0 if neither box is checked, 1 if just one is checked and 2 if both are checked.

 

Formula is written:

 

if(and(Bolts End 1, Bolts End 2), 2, if(Bolts End 1, 1, if(Bolts End 2, 1, 0)))

 

Plain english format: if Both parameters are check use 2, if this one is checked use 1, if this other one is checked use 1, if neither are checked use 0


Steve Stafford
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
EESignature

Message 7 of 8

Secttor
Collaborator
Collaborator

I quess this is what you need.

Capture.JPG

Revit MEP - Electrical Certified Professional
Revit MEP - Mechanical Certified Professional

Draftworks.wordpress.com
0 Likes
Message 8 of 8

GTisRuleX
Advocate
Advocate

You guys are awesome!  Got it applied and already working!!

 

I just needed to drop the "=" it looks like, I had the formats right!