When is a String a String?

Hi Guys, This should be simple but what am I missing here? I have a custom node to filter by value. If I use a string value from a code block is processes fine. But when I use a string from obj node, it doesn’t.

The issue is not with the string. You would get an error saying the input type is not a string if that were the case. You’re still getting a valid output, just not what you expected.

The actual issue is that you’re feeding it a list now instead of a single string item. You need to reduce the list down to a single unstructured item. You might also be able to get by with list levels in this case.

2 Likes

That gives me a better clue but, I thought that is what I was doing with the flatten node so that the list is at level 1? It won’t flatten any further removing the Index from the output. IS there another node that will work?

Flatten removes all the structure (or list levels) from a list, but it’s still a list. The output is @L2 because a list has to be at least 2 dimensions - one for the list and one for the items inside the list. If you look at the output of your code block string it’s only @L1 (implied since nothing is shown). There is no list structure.

You need to get the specific item from the flattened list in order to reduce it any further.

Ok, I think I got it. You pointed me in the right direction thanks for your help.

2 Likes