-
-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Adding Array Data to Array Field Failing #93
Comments
That looks correct to me?
Can you send the log through please?
…On Tue, Mar 5, 2019, 12:57 aminediab ***@***.***> wrote:
Hi Phill,
I have modified the diet plan class and added an ingredients array field,
and successfully created the object. now when testing the add function I
got an parse error on result with Unexpected token s in JSON at position
43, check the code below:
void addArray() async {
var list = ["sugar", "rice", "salt"];
var apiResponse = await DietPlan().getObject('j2S0JZhbpC');
if (apiResponse.success && apiResponse.result != null) {
var dietPlan = (apiResponse.result as DietPlan);
var response = await dietPlan.add('ingredients', list);
dietPlan.save();
} else {
print('ERROR');
}
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#93>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHgn3pZcbVN6PrXNwTECVHKznCyGX4ejks5vTmnQgaJpZM4bei8F>
.
|
The server access log showing: 185.40.210.13 - - [2019-03-05T13:17:23.696Z] "POST /serverInfo" 200 2 ms 218 bytes_in 731 bytes_out |
the debug console output: Launching lib\main.dart on T06 in debug mode... |
Is this what you want? |
Yes, it wasn't as helpful as I hoped though, ha.
I will look into this shortly for you.
…On Tue, Mar 5, 2019, 14:01 aminediab ***@***.***> wrote:
Is this what you want?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#93 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHgn3gRypOfGYgzFZ-8TQ6lfXOz1njiQks5vTni4gaJpZM4bei8F>
.
|
Phill, I think it is apparently trying to parse something that isn't Json, that's my take on it! |
Hey, I think this might have been fixed by one of our contributors. Can you try again please? |
Hi @phillwiggins. I did the fix and it's tested. @aminediab, The correct way to implement is: void addArray() async { |
Hi Phill & Rodrigo, The ERROR persists. The first portion; the apiResponse is a success and it returns the object correctly, however adding fails with a Parse Error, (Unexpected token s in JSON at position 43) thanks, |
Just to be clear, the add operation should append the list to the array field, i have manually entered a string list in the ingredients field and then ran the code as suggested! |
@phillwiggins Do you know if it is possible to use the master instead of a release? |
Maybe try this? parse_server_sdk: |
@aminediab dependencies: Try again. Sample yy code: apiResponse = await objeto.addUnique("lista", ["a", "a","d"]); apiResponse = await objeto.addUnique("lista", ["a", "d", "e"]); apiResponse = await objeto.remove("lista", ["d","e"]); My log: |
Thanks @phillwiggins . It worked |
Hi All, |
Your welcome.... But mainly thank Rodrigo for his efforts!
…On Fri, Mar 8, 2019, 21:43 aminediab ***@***.***> wrote:
Hi All,
It is working!!! thank you for all your efforts, Phill and Rodrigo.
cheers,
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#93 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHgn3uFvsyTsgGeDp_awMBC0NxF2FTjlks5vUtmIgaJpZM4bei8F>
.
|
@phillwiggins Resolved in the last release. Updated documentation. |
@phillwiggins |
Let say, if i use the following method to add array. It's working. var manage = ParseObject('Test') This saves my values in the Back4App database. But, when i try following code to update my class values, var manage = ParseObject('Test') Above code doesn't update my current object/list anyway. How to update parse objects and parse list for back4App ? Thanks. |
Hey Mungra.
If you create an instance of a ParseObject, then save it, your ParseObject
will be assigned an objectId. Once you have created your object and saved
it, manipulate the same object in whatever way, then call update. Does that
work?
At the moment you are simply creating 2 new objects instead of updating the
same one, I think?
…On Fri, 24 Jul 2020, 06:32 Mungara Jay, ***@***.***> wrote:
Let say, if i use the following method to add array. It's working.
var manage = ParseObject('Test')
..set('name', "Test")
..set('email', ***@***.***")
..set('age', 15)
..setAdd('hobby', ['Play Chess', 'Watch Movies']);
await manage.save();
This saves my values in the Back4App database. But, when i try following
code to update my class values,
var manage = ParseObject('Test')
..objectId = widget.id
..set('name', "Test")
..set("email", ***@***.***")
..set('age', 18)
..setAdd('hobby', ['Travel', 'Fight']);
await manage.update();
Above code doesn't update my current object anyway. How, to update parse
objects and parse list for back4App ?
Thanks.
But, it's not updating my object
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#93 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4CPXQLDIKMPWPGAMNTISLR5EMFRANCNFSM4G32F4CQ>
.
|
I have tried updating the same reference as well. like, ParseObject('Employee') But, it doesn't work. So, Can you please add that line of code here? |
Something like that should work? |
Hi Phill,
I have modified the diet plan class and added an ingredients array field, and successfully created the object. now when testing the add function I got an parse error on response with Unexpected token s in JSON at position 43, check the code below:
void addArray() async {
var list = ["sugar", "rice", "salt"];
var apiResponse = await DietPlan().getObject('j2S0JZhbpC');
if (apiResponse.success && apiResponse.result != null) {
var dietPlan = (apiResponse.result as DietPlan);
var response = await dietPlan.add('ingredients', list);
dietPlan.save();
} else {
print('ERROR');
}
}
The text was updated successfully, but these errors were encountered: