I’m trying to update sensor values using CloudDB.
I’m using redislab server with free subscription.
The issue is, I update a tag say “x:val” with a comma-seperated value=“50,60,70,80,90”.
However, the CloudDB GotValue block only receives “50” trimming the rest of stuff from and after the comma.
I rechecked the tag values from redis-cli and the values are stored correctly on the server.
However the GotValue is unable to retrieve the complete string.
Is it a bug?
Is there another way to achieve what I’m trying to do?
You probably need to use a different delimiter, one that CloudDB/Redis won’t treat as a field separator.
Try “|” or “-” between your numbers 50|60|70… or 50-60-70. You will need to do a bit more work on your code going up and coming back, but hopefully you will get it all!
I am sending data up using the arduino-redis library.
The method takes a char array as parameter.
So I’m converting a string using toCharArray() method.
Although I do not use it (arduino-redis) and have no experience of it, I find that quite hard to believe...surely one must be able to send a string value. How would you set a key value pair of "myValue":"Hello World" ?
If I store the comma-seperated values between quotes, then the CloudDB components correctly retrieves the string WITHOUT quotes.
For example, in redis server, I store the string as “50,60,70,80” (including quotes) and CloudDB GetValue retrieves it as 50,60,70,80 but as I said, it could be improved in subsequent releases.
That is not a workaround, that is how you should store it if you want to avoid to online storage from using the delimiters. AI2 stores it that way, you just don’t see the double quotes because they are “in” the text block.
But you are posting a string myVals:“50,60,70”, so you would replace it with a string myVals:“50,60,70,80”, or add another field with more values myVals:[[“50,60,70”],[“80”]] or post your data as individual fields in the first place myVals:[“50”,“60”,“70”] - you can probably post this as a string and it will be recognised as a list.
The CloudDB component serializes and deserializes the values as JSON. By wrapping the CSV in quotes you are turning it into a JSON string. You could just as well wrap it in square brackets to make it deserialize as a list. This is not a bug but is the intended behavior.