Data structuring in Dynamo


I have a question on how to fit in a value into a chart / data and get the outcome from it.

Long story short, I made a script where it calculates two angles from two triangles, then it identifies the smaller value / angle.

There is a chart that I need to insert those angles and get the value from it.

here is an example,

Let’s say the angles are 40 & 50deg. Take the smallest. See where that angle fits in the table below It falls into the gray zone ranges, So the occupant has a View Factor of 4.

Is there a way where I can use IF nodes or any List nodes to get these view factor values at the end?

Please let me know if there is any further question / explanation.

Thank you for your time in advance.

Check out this thread for concept on grouping a list of values by ranges.

Sounds like you want to do three things:

  • Bin each minimum angle into a range.
  • Associate that bin with a preliminary view factor
  • Output the view factor in a list compatible/organized for your next task
1 Like

You’re better off using a code block with multiple nested IF statements. It would look something like this:

Typical IF statement:
condition ? true_response : false_response;

Nested IF statement:
condition1 ? true1 :
condition2 ? true2 :
condition3 ? true3 :
(continue as needed)


thank you for the response.

owww thats going to be a big mountain for me but I will try to figure it out.
I assumed that coding @ code block would solve this problem easily - however, I gotta figure out what to code it.

regardless thank you very much!

thank you very much for this link.

I will take a look into it.

Should be pretty straight forward since you’re just looking for a value within a range, but the gray area part may be a little more involved. I’m a little confused by it so I don’t really know.


Code block example :slight_smile:

For the grey range, @Nick_Boyts is correct, it really depends on how this assessment of which way (1 or 2) to lean the result is to be used in subsequent workflows.


A slightly untidy approach using a dictionary

dict.dyn (6.7 KB)

dct = Dictionary.ByKeysValues(key<2><1>,val<2>);
vlu = List.Clean(dct.ValueAtKey(ky+""),false);
1 Like

thank you for the response.

This works perfectly! Truly appreciated.
Quick question, I want to write a code that does;

If Input => 3 ? YES
If Input < 3 ? NO

I tried my own to code by myself but no good. Any advice? thank you in advance!

1 Like