Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

Formula using if / or

8 ANTWORTEN 8
GELÖST
Antworten
Nachricht 1 von 9
Mike_Sanderson
542 Aufrufe, 8 Antworten

Formula using if / or

Hi,

 

I am trying to get a value output depending on which yes/no parameter is selected.

It seems fairly simple but I am not quite getting it.

 

In the image attached I have split apart the if formula, so obviously it does not work, but hopefully you get the idea of what I am trying to achieve. 

 

mikePZQMX_0-1668544802194.png

 

 

 

8 ANTWORTEN 8
Nachricht 2 von 9
mhiserZFHXS
als Antwort auf: Mike_Sanderson

Embed the ifs within each other

 

if(Parameter A, 1, if(Parameter B, 2, 3).

 

So the true value for parameter A is 1, and the false value is determined by parameter B. You don't actually need to include Parameter C, as you can just have that value as the result if parameter B is false.

Nachricht 3 von 9
Mike_Sanderson
als Antwort auf: mhiserZFHXS

So simple, great thanks.
In addition to this, what is there where 5 parameters?
Nachricht 4 von 9
ToanDN
als Antwort auf: Mike_Sanderson

I would add 3_Wild Zone_High to the formula to be certain only it gets the value of 30.  If an user enters something other than 1 , 2, 3 then the outcome is 0, not 30.

 

if (1_Wild Zone_Low, 10, (if (2_Wild Zone_Medium, 20, (if (3_Wild Zone_High, 30, 0)))))

Nachricht 5 von 9
mhiserZFHXS
als Antwort auf: Mike_Sanderson

Keep embedding if statements.

 

if(Parameter A, 1, if(Parameter B, 2, if(Parameter C, 3, if (Parameter D, 4, 5))))

 

You just need one less parameter than you have values, as the false result in the last if statement can just be whatever the last value is without a parameter tied to it. (My example doesn't have a parameter E, it just has 5 as the last result).

Nachricht 6 von 9
crapai
als Antwort auf: Mike_Sanderson

I'm not sure if this is because the if statements were split apart but,

 

If statements need to be nested inside themselves so that the next if statement becomes the else of the first. As the last else statement I usually use a value that will indicate that the user hasn't chosen a yes/no parameter. Also keep in mind that this type of formula structure will go with whatever true statement it finds first so if 'a' and 'c' are checked it will read 'b'. If none are checked it will read 'x'.

 

If(a, b, if(c, d, if(e, g, x)))

Nachricht 7 von 9
mhiserZFHXS
als Antwort auf: ToanDN

@Mike_Sanderson 

 

Regarding @ToanDN 's response, which is valid, what kind of parameters are these? Are they integers, text, speed etc?I would think having a 0 could be confusing to users other than yourself. If its a text parameter, or can be a text parameter, maybe have the final false statement say "Wind Zone Selection Input Invalid".

 

 

Nachricht 8 von 9
Mike_Sanderson
als Antwort auf: mhiserZFHXS

This is mostly a learning exercise for me, so not sure if this will ever actually get used in our office.

The "Wind Zone Selection" is an Integra. I am just playing with some ideas at the moment, so this may not stay.

The Integra is a less complicated way of only ticking 1 yes/no parameter. I have seen that the formula to control only ticking 1 yes/no parameter is very complicated, and way over my skill level. 

 

 

Nachricht 9 von 9
ToanDN
als Antwort auf: Mike_Sanderson

This is to entertain yourself:

https://www.revitforum.org/node/1126

 

Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.

In Foren veröffentlichen  

Autodesk Design & Make Report