Skip to content
Back

using integer values in enum causing errors

  • 0
  • Web
  • Cloud
Franco van Vuuren(u21463702)
18 Oct, 2023, 19:15

I have an enum with two elements e.g. 'dave' and '1emily1', inserting a field with the enum set to 'dave' works as expected but inserting a field with '1emily1' as the enum paramter return an internal error 500.

I am doing this since I want to use id's as elements in my enum attribute.

Is this simply not possible? there is no problem adding an enum with integer values in the appwrite dashboard but the request to do it fails.

TL;DR
The user is experiencing an error when trying to use integer values in an enum. They have tried removing and adding the elements multiple times but the error persists. It seems that the enum recognizes that the element exists, but fails to add the field if the element contains numbers. The user wants to use ID's as elements in their enum attribute. Is this possible? Solution: It appears that using integer values in the enum attribute may not be possible as the request to do so fails. The user can try using string values instead.
Drake
18 Oct, 2023, 19:16

weird..what's your project id?

Franco van Vuuren(u21463702)
18 Oct, 2023, 19:38

645c7e03796ad3f1640b

Drake
18 Oct, 2023, 19:42

weird...im not seeing anything for that project id...

Drake
18 Oct, 2023, 19:44

seems to work for me:

Drake
18 Oct, 2023, 19:45
Drake
18 Oct, 2023, 19:45

can you try removing the elements and adding them back?

Franco van Vuuren(u21463702)
18 Oct, 2023, 19:56

I have removed and added the elements a couple of times, if I try to add a field with a attribute thats not in the enum elements I get like a error saying the paramter should be one of these (dave, 1emily1) or whatever it is, but doing it with the correct element doesn't throw this error

So it is recognizing that the element exists in the enum it just fails to add the field if the element contains numbers for some reason

Drake
18 Oct, 2023, 20:08

and you're testing via the console?

Franco van Vuuren(u21463702)
18 Oct, 2023, 20:13

have a react project setup and using the web sdk

Franco van Vuuren(u21463702)
18 Oct, 2023, 20:14

does it work for you if you test with a element in the enum with like a project or field ID? it may be related to the length of the element

Drake
18 Oct, 2023, 20:40

oh wait....did you create it with 1 element first and then added a longer one?

Franco van Vuuren(u21463702)
19 Oct, 2023, 13:29

yes

Drake
19 Oct, 2023, 14:52

that might be the problem

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more