Formula condition with text

Formula condition with text

Joris.vd.Meulen
Collaborator Collaborator
33,704 Views
12 Replies
Message 1 of 13

Formula condition with text

Joris.vd.Meulen
Collaborator
Collaborator
Hi,

Got myself a some fields:

"fireresistant" which is a 'number'.
"test" which has a formula: IF(fireresistant > 0, 10, 20)

So if fireresistant is set to let's say 30, test becomes 10. Works fine.

But now I notice in the Identity Data there's already a pre-set parameter 'Fire Rating'.

So I want to use that one
"test"'s formula becomes: IF(Fire Rating = "0", 20, 10)

But now I get a message: "improper use of boolean expressions".


My question: is it possible to use a formula with these kinds of parameters (Fire Rating - which is a 'text' I assume)??


3Pinter
love python coding
0 Likes
Accepted solutions (2)
33,705 Views
12 Replies
Replies (12)
Message 2 of 13

Anonymous
Not applicable
Accepted solution
On 5/25/2010 6:36 AM, Joris3P wrote:
> My question: is it possible to use a formula with these kinds of parameters (Fire Rating - which is a 'text' I assume)??

No, Revit's formulas are limited to mathematical (numbers, lengths,
computations, etc.) and logical (yes/no, not, and, or) operations. Text
parameters cannot be used.

--
Brian Winterscheidt
LWPB Architecture
Oklahoma City, Oklahoma
Message 3 of 13

Anonymous
Not applicable
Accepted solution
No. Strings are not allowed in the IF condition, but they are allowed in the "do this if true" and "do this if false" actions. You can work with numbers (reals or integers) in the IF condition, instead. For example: if you add a shared parameter such as "Fire rating code", then add a project instance parameter, as an integer, that applies to Doors, you could assign a Fire rating of 1, or 2, or 3, to your doors. Now, suppose you have a text parameter named "TextField" in your schedule. Then, you could add a calculated value to your schedules with something like:
IF (Fire rating code = 1, TextField = "Yes", TextField = "No")
Message 4 of 13

Joris.vd.Meulen
Collaborator
Collaborator
Okay guys,

Thanks for your replies. Helped a lot!.

3Pinter
love python coding
Message 5 of 13

dyakovenko73GY8
Explorer
Explorer

Current version is 2022 and still no opportunity to create conditions based on text values!!
Shame on you! This could improve the designing workflow, but seems like Autodesk doesn't care about its products quality.

Message 6 of 13

robinVW982
Contributor
Contributor

I agree. I always end up having to work around problems with long formulas.. 

Wish Autodesk could start implement some improvements.

Message 7 of 13

EddieSaez
Advocate
Advocate

Agreed... then maybe.. just maybe the new features will be worth the upgrade

Message 8 of 13

crystal.nupsonS8SQU
Explorer
Explorer

For an If and statement, both things  need to be true for something to be true. If one of those things are false, then the statement is false.

 

For an If or statement, only one thing needs to be true. If one of those things are false, then the statement is true. If both are false, then it is a false statement.

But what if the statement is true, then you might have multiple things be true.
For example, if the yes/no is checked for the 3 lite count, then two mullion visibilities should be shown. What I want is if the statement is yes, then this yes/no visibility is yes and this yes/no visibility is yes, if no than visible invisible line. 

Another thing that would involve string is the if if statent.  if lite count horiz 2 is checked, I need the integer 2, if lite count horiz 3 is checked, I need the integer 3, if if lite count horiz 4 is checked, I need the integer 4, if none of then 1

crystalnupsonS8SQU_0-1671827832877.png

 

0 Likes
Message 9 of 13

laura.johanssonPN37Y
Advocate
Advocate
@Anonymous
Is there a way I can make this so that if box 1 and box 2 is ticked then Textfield A, if box 3 and box 4 is ticked then Textfield B, If box 1 and box 3 is ticked then Textfield C, and so on? I have a case where I have 4 tickboxes and 6 different textfields based on the box combination
0 Likes
Message 10 of 13

RJU_Vinitex
Contributor
Contributor

Yes there is but it'll be lengthy with exponentially lots of IFs; I tend to make use of a Lookup Table in such cases. Make your YES/NO parameters for the boxes (1,2,3,4 etc). Make your TEXT parameters for the text fields (A,B,C etc). As for the parameter that does what you want it to do:
Type of parameter: TEXT
Formula: IF(AND(Box1,Box2), TextFieldA, IF(AND(Box3,Box4), TextFieldB, IF(AND(Box1,Box3), TextFieldC, TextFieldD)))

 

If the TextField parameters have a text that will always be the same (text that doesn't need to be changed) you could skip making those parameters and just use quotation marks with the text in between them. For example:

IF(AND(Box1,Box2), "Hello", IF(AND(Box3,Box4), "Goodbye", IF(AND(Box1,Box3), "Greetings", "Cheerio!")))

0 Likes
Message 11 of 13

lorelei_thompson3AA2X
Observer
Observer

I'm having a problem with  inconsistant units in a generic annotation family. I have a yes/no parameter CheckBoxA and a text parameter TEXT. When I type the following formula into the TEXT parameter =if(CheckBoxA, "Yes", "No") I get the inconsistant units error. What am I missing?

0 Likes
Message 12 of 13

blank...
Advisor
Advisor

@lorelei_thompson3AA2X wrote:

I'm having a problem with  inconsistant units in a generic annotation family. I have a yes/no parameter CheckBoxA and a text parameter TEXT. When I type the following formula into the TEXT parameter =if(CheckBoxA, "Yes", "No") I get the inconsistant units error. What am I missing?


Strange, works exactly as you described. Can you share the family?

0 Likes
Message 13 of 13

Joris.vd.Meulen
Collaborator
Collaborator

I -think- you have the wrong parameter settings. 

Ensure your parameter is set to "text". 

 

JorisvdMeulen_0-1724833713827.png

JorisvdMeulen_1-1724833981258.png

 

love python coding
0 Likes