Change a val into a number

Hello i try to change the Season names into a Number but didn't work.
So maybe some have an Idea. Thank you for any kind of help.

image

More context will be needed to understand what you're asking here.

Your image suggests that msg.payload.val = 'WINTER' what do you want to change this into?

You could do change text to a number in a change node

for example

Change msg.payload.val
search for WINTER
replace with 1

I'm sorry today is not my Day. I'm getting via Openhab the season Name ( "WINTER" )
But I wanna change "WINTER" into 1, SPRING in 2, Summer in 3, Autumn in 4.
Just into a number. I tried it with a function and a change.

image

Try a change node with a configuration like this: 33%20AM

It looks like your message may be a JSON string rather than an object, so you may need to pop a JSON node in before the change node to break out the val property.

Thank you very much it works. Have a great day. :grinning: