Custom state doesn't accept the value I want it to give

I have a datatype Sessie, which has a number field. I want to make a button which filters on session number. My idea is to pick the session’s number value as custom state value, so I can use that on a group (“Documenten”) I want to filter. I yet have to discover how exactly to do that last part, but I am already stuck in creating the value to begin with.
Bubble Io doesn’t accept it and I cant see why:

2023-05-11 16_31_51-CoachBPT _ Bubble Editor en nog 9 andere pagina's - Werk - Microsoft​ Edge

Hi there, @woezel1980… the error message in your screenshot is telling you what the issue is. Your custom state has a type of Sessie, so when you are setting a value for that custom state, the value has to be a thing in the Sessie data type. The problem is that you are trying to set the value to a text value instead of a thing in Sessie data type, and Bubble is telling you about the type mismatch. If you change the state type of your custom state to text, you should be able to get past the error you are encountering.

Hope this helps.

Best…
Mike

1 Like

Thanks for your reply!
Well, I don’t actually understand this.
“Sessie” is a datatype, with a field named “number”. I would like to create a custom state with the value of that number. Then I should use a custom state type Sessie, shouldn’t I?

The problem is that you are trying to set the value to a text value

Is the part I don’t understand, I guess. How/why am I setting the value to text?

I changed the state type to text and the message is gone. It works now, but I don’t fully understand why my initial attempt did not work.

No…, for that you need a custom state of type Number.

How/why am I setting the value to text?

Only you can know that for sure (but presumably, the field on the Sessie datatype that you think is a number is actually a text).