I’ve got a list that I want to filter out based on if a number is below a certain value. I’m sure I’m missing something simple, but it’s driving me nuts trying to get this to work. My list looks like this:
I want to remove the lists where the value of the 3rd item (numbers in blue that are station values) is greater than a certain value.
This is what I’ve got going so far. I’m able to grab the stations, do a comparison for anything less than the input value and use the filter mask to remove all of the ones greater than the value I want. But how do I use this to get the overall list trimmed? I tried using the main list as the input for the filter, but I can’t get it to work properly.
I’m sure it’s a basic levels issue that I’m having trouble with. Can any of you gurus help me out?
hi
edit: If list depth is a priority later
cordially
christian.stan
2 Likes
Just use the default levels (no overrides) and you should retain list structure.
I think my problem is how the value is being passed to the comparison. In your list you used a code to get a simple list of booleans, but if you noticed on mine it provides a nested list of true/false. I am grabbing the end station of a C3D view frame to get the value of 53700 as the test condition as the Y value. The X is coming from the station list. However, if I use no levels from that list the less than node only gives 1 value. I had to use a list of @1 to get it to compare to each record.
Maybe I need to simplify the comparison list so it’s not nested before passing to the filter?
I got it to work with some tweaks using your example! First, I flattened the comparison node list of booleans & removed the levels from the mask filter input. Then I changed the filter input list to level @3 like you showed and it worked!
However, after I did all that I realized that the people who made the view frames didn’t update their last frame properly, so the station value was too high. I switched it to a manual number, which means I could get rid of the flattened comparison input and it results in this:
Thanks for the help!
2 Likes
Your list levels are still a little messy. The main issue is that the value you’re comparing (53600) was originally in a list. You need to reduce that to a single value so that the levels work out. You’ve done that in the example above, but now you’re filtering @L3 (even though your list is already at L3) which is actually adding another layer of lists to your output. With the correct list structures you don’t actually need any additional list level controls.
I've been away from Dynamo for a long time...
I want the assemblies in the second list to be added. How should I do it?