Obtain Only Items that are Double from List

Hi there,

May I know what’s the best way to obtain only items that appear as decimals/doubles in a list?

Thank you!

You should be able to use Object.Type to filter the items.

Thank you for the help, I have another question after using the Object.Type node, how am I supposed to extract the items out after filtering them? I’m not sure what to put in the false input for ‘If’ node, and the list.filterbyboolmask node doesn’t seem to work. I understand that it’s the "null’ values that’s causing the warnings but I guess I am going to ignore them for now…

Thank you :slight_smile:

I would use a FilterByBoolMask. You still have to handle the null values, but then you would filter your original list by those booleans.

1 Like

replacenull with false first at string.contains before filter

1 Like

Thank you!

Hello @efyst2

To make a script with datashapes UI work good i would recommend to test your outputs before passing them to other nodes.
If a user cancels the UI, closes the UI or gives no inputs, the script should stop running by passing an empty list.

And you can even adapt such a test-codeblock for any other needs:

x;
[Imperative]
{
	return (List.IsEmpty(x))? []:
	(x==null)? []: x;
};
1 Like

You can also use the List.RemoveIfNot node, which essentially filters out anything that is not of your chosen type :slight_smile:

3 Likes

Thank you for all the useful tips!! :smiley:

1 Like