Work flow based on slider value selected by user


#1

I’m looking for a way to direct the workflow in a graph based on a slider value. The slider is set to a maximum of 5 so I have 5 possible results. If this were VB.NET I’d use Select Case. What is the equivalent dynamo way? Thanks.


#2

Need to see more of what you are doing based on the slider. Could be as simple as List.GetItemAtIndex or an If statement.


#3

Thanks Jacob.
If slider = 1 then 1 door, If slider = 2 then 2 doors… In the end the selection will fill in a text parameter.


#4

So this then:
X==1?
“Door”:
X==2?
“2 Doors”:
X==3?
“3 Doors”:
“How many doors do you want?”;


#5

5 doors. Thanks


#6

I intended that as “you can see the pattern now and continue this for how ever many doors you want”…

But looking at it now, I’d go another route:

X==1?
"Door":
X+" Doors";

#7

Thanks. Does that go in a code block?


#8

Yes. Post your graph if you’re still lost after this.


#9

Here’s that portion of the graph. Thanks.


#10

Place the previously provided text in a code block above and let me know what the issue is.


#11

Thanks. The last code worked however I prefer your original version if I can make it work. I may use it for other things and they may not be sequential.

here’s the error I’m getting with the original version. Syntax error I’m guessing.

Capture


#12

you need an else value for the last if statement. “well this is weird as the inputs should have been limited to 5” could go in before the “;” to fix that.


#13

Hmmm. I still have something wrong…

Capture


#14

Saw the double X at the start. Took it out but still not working, Thanks for the assistance.


#15

image

You should consider reading the Dynamo Primer
http://dynamoprimer.com/en/
It describes the use of code blocks as well.


#16

Perfect. Thanks.