Back

[SOLVED] Storing an Array of Arrays

  • 0
  • Databases
ZachHandley
1 Oct, 2023, 18:19

Hey there.

So I'm trying to store an array of arrays, specifically RGB color values. Is it possible to store that, or should I just acquiesce and store the hex strings? I have them JSON.stringified in there but when i try to parse them on retrieval it is erroring so I need to figure out why, but wanted to post to see if anyone has any tips for this

TL;DR
The user is having trouble storing and retrieving an array of arrays, specifically RGB color values, using JSON.stringified in a Nanostore. They are experiencing errors when trying to parse the values on retrieval. They are asking for tips or a better solution for storing the values. The issue has been solved, but the solution is not specified in the thread.
Drake
1 Oct, 2023, 19:07

What exactly is being stored and steingified?

ZachHandley
1 Oct, 2023, 19:32

Basically

ZachHandley
1 Oct, 2023, 19:32

I have a Threlte scene

ZachHandley
1 Oct, 2023, 19:32
ZachHandley
1 Oct, 2023, 19:32

and I have color configuration options for it for the progress bar colors on the road (it's animated and is used to show score) and HTML inputs require hex, but I need RGB because to animate the RGB's I animate each individual value

ZachHandley
1 Oct, 2023, 19:32

the Progress Bars can have multiple colors, so each one has an array of RGB values, or an array of arrays

Drake
1 Oct, 2023, 23:41

Can you share the stringified string?

ZachHandley
2 Oct, 2023, 05:19

It’s [[1,255,17],[23,47,155],[144,16,182]] for example

ZachHandley
2 Oct, 2023, 05:20

An array of RGB arrays

ZachHandley
2 Oct, 2023, 05:21

The actual would be like that with quotes around it but Appwrite shows the value without quotes

Drake
2 Oct, 2023, 20:13

what's weird...it should work...

  1. what is the attribute type?
  2. what exactly are you getting back from the database?
  3. what is your code?
ZachHandley
3 Oct, 2023, 05:45

All good I figured it out, I appreciate it, was mostly curious if a better way existed

Drake
3 Oct, 2023, 13:40

What did you end up doing?

ZachHandley
3 Oct, 2023, 15:13

So I’m using a Nanostore which has an encode and decode functionality built in with local storage but I basically found out that it was missing one of the values somehow and idk for whatever reason that was breaking it during the parse, I’m currently on Websockets haha

Drake
3 Oct, 2023, 17:51

ah interesting 👍🏼

Drake
3 Oct, 2023, 17:51

[SOLVED] Storing an Array of Arrays

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