How to filter odd number and even number in the list containing alphabet?


#1

Hello, Dynamo users! :grinning:

I’d like to sort odd numbers and even numbers in the list containing alphabet. I am using string.contains but the list doesn’t work properly. (Null)

below are some screenshot of what I am working on…

Thanks all !

image


#2

It’s note clear that you’ve got elements coming out of your List.FilterByBoolMask - they appear to be parameter values instead. That should be a separate question though (likely you are filtering a list of parameter values, not a list of elements).

This is how you group even/odd values. Use a List.First/List.Last to get the even/odd values from the list.


#3

Thank Jacob, that is awesome, which is what I needed.
you are correct I am filtering parameter values.

but mine output is still null, do I need to flatten the list ?
I am uploading my rvt and dyn for ease of reference

Intersect Element test 3_v2.dyn (59.1 KB)
Test_Project1.rvt (1.9 MB)


#4

Flatten the list or use list at level 2 on all nodes if you need to keep the structure.

It’s unlilely you want to filter parameter values - sticking to the elements directly will usually save a lot of headaches.


#5

Thank you Jacob ! Thanks for showing me the way , all good !