Hey everyone, ive been looking through the forum for examples on multiple if statements. But, all i could find are one if statement examples. Does anyone know how to do this with nodes or design script?
Try this code block:
a==6? "Family 1 Goes Here": a==2? "Family 2 Goes Here": "Family 3 Goes Here";
You can go as deep as you like, and remove the quotes to use different families which will become inputs to the node instead of strings.
Do i just put in the family name where it says “Family 1 Goes Here”? When i remove the quotations i get an error.
Replace item at index
Post what you did so I can walk you through it. All versions of Dynamo for Revit was uninstalled by IT in my computer last night so unfortunately I can’t do it directly for you.
That was it. For speed sake remove the a; b; c; … g; part. The input variable can be called after the fact in this case and it will make things read better and can help with performance on larger graphs too.
thank you once again!
I have a scenario where a STRING response is required to be returned, depending on whether a value occurs between ranges of values. But l have tried it with IF statements, <=, >= etc, but no joy.
Any thoughts on what l am doing wrong?
My value is 8.085, therefore l am expecting response ‘b’, but l get “”
Are you certain all your values are “flattened”?
You don’t have a valid conditional statement. You need to use && for a range of values.
Just ask them in sequence - if it’s less than 5.4 then return the first value. If the value wasn’t less than 5.4 but it’s less than 8.5 then your number falls between 5.4 and 8.5. No need to check if it’s > 5.4 a second time.
That said, the logical statement you couldn’t find is:
T> 5.4 && T< 8.4
Though the upper value should likely be a <= test.
You’re still doing 2x the amount of computations here - Only ask something once unless you have a requirement to do it twice. By asking smallest to largest you’ll remove parts from the set sequentially.
I am doing something wrong here but I cannot figure it out. Any of you have an Idea?
Edit: List.Firstitem output was a string not a number. Simple String.ToNumber and it works fine now.
Some times you get drawn into what you are doing and you forget to look at what you have done.
Ya sorry it was a string. I was zoomed in to much and forgot what the data was.