Delete empty position

Hi,

ist there a chance to delete the empty position?

Delete%20empty%20position

You can use CleanTree component like this:


Michael.gh (16.7 KB)

There shouldn’t be any “empty” positions in a list.

My guess is, your numbers actually are strings, because those can have no content and still be valid.

You may route those numbers trough a number parameter to make sure of the type. Empty strings should translate to NULL. You can then clean up the NULL items.

In Michael’s example, seems that the item is a whitespace string, not a null nor an empty item. If they are strings with whitespace, you can remove it with TextTrim component, then use CleanTree to remove the empty item, like mentioned above

Thank you, it works perfect

In this case, the most promising method is to connecting the data to a number parameter and then cleaning the null, invalid and empty items.

That is assuming your list only made of integer types. In general, its not a good thing to have red components.

Red means a failed operation. You can use that to determine the validity of your input.
Or you can just assume your input is always valid. Then you wouldn’t have Michaels problem in the first place :wink:

I know it’s kind of dirty, but I use typecasts like that pretty often. Sometimes operations have empty or null input in some branches so the entire component will turn red. Als long as you know why and what’s happening, even red components shouldn’t bother you.

1 Like