Filter of values by another list [It's not a simply issue], logic issue

Dears,

I’m trying to get a very difficult matter into dynamo. Humbling, I guess it’s a logical matter to solve.

I have two lists, find them below.

The first list, it’s what a want to filter, second list it would be the mandatory one.

Each sublist from the second list represents a value from the first list, image below:

The string “Down” indicates the needed index is coming from the upper sublist.For example:

From the image, the sublist [3] has 5 “Down” values, means that those values belongs to sublist [2]. So, There are, 5 values 1180, though, sublist [1] shows one value is “Down” means that from these 5 values = 1180, one of them belongs to the upper sublist, 1170, then I get 4 values = 1180; 1 value = 1170.
Sublist [1] Shows one value is “Down”, thats means that value into sublist [1] belongs at the end to sublist [0].

Finally, the result must be

Sublist [0] : 1Value
Sublist [1]: 0 Values
Sublist [2] : 4 Values
Sublist [3]: 0 Values.

Finally what I’m trying to get a list with
[0]
1160
[1]
1180
1180
1180
1180

I suppose you’re trying to do something like this …


filtervalues.dyn (20.8 KB)

1 Like