Forum

Beta27 String2Enum bug?

When i connect a string to the “String2Enum” node
it becomes red and output (nil) Enumeration.

string2enum_bug.v4p (3.6 kB)

string2enum needs to be connected to an existing enum. if the string input equals any entry in the enum, it will be selected. if it doesnt exist or string2enum is just not connected to anything, the node will turn red. right ?

yes. thats totally correct.

The enum type has to be set to be able to convert a string into an enum entry. In general types are pushed upwards, so you have to connect a node with known enum type somewhere downwards.

This is the same behaviour as you can see when an IOBox (Value Advanced) is connected to the input of an I (Spreads) or an IOBox (String) that is connected to the Filename input of a Reader (File). The respective types (integer & filename) get pushed upwards.

In case that you create your own enum with CreateEnum (Enumerations), the only node that can be configured to really need your new enum is the NULL (Enumerations). So this is the one you need to connect.

string2enum_demo.v4p (13.6 kB)