Filter by Bool Mask

Is there a way to use the List.ByFilterByBoolMask in the Code Block.

I am able to put it in, but unable to figure out a way to separately extract the filtered in and out results.

Thanks.

Regards,

Vikram Subbaiah

Multiple output nodes actually return dictionaries. You can pull a specific output by supplying the name of the output as the dictionary key. For example:

codeblock multiout

Thanks Stephen!

Hi Stephen
i tried to replicate you code block, however i have an error of multiple definition found…? not sure how to fix that?

@Batman86 On the third line, filtered not filter

lst = 0..3;
mask = {true,false,true,false};
filtered = List.FilterByBoolMask(lst,mask);
x = filtered["in"];
y = filtered["out"];

Also if you have the Archi-lab.net package installed you need to use DSCore.List to avoid confuision with Archilab.List

lst = 0..3;
mask = {true,false,true,false};
filtered = DSCore.List.FilterByBoolMask(lst,mask);
x = filtered["in"];
y = filtered["out"];

Awesome thanks Einar and Vikram, that made it work perfectly.

Cheer Michael

Just to add in to this conversation, using the Dictionary output like so only works on flat lists. If you wish to call on multi-ranked lists you’ll need to use the same method that Node2Code gives you.

As a side note, you can also directly call the output if you don’t care about the alternative like so:

lst = 0..10;
mask = Flatten(DSCore.List.OfRepeatedItem({true,false},Count(lst)/2));
filter = DSCore.List.FilterByBoolMask(lst,mask)["in"];