Question

i want to ubdate array field by using "push" to Append specified values to array. but i didnt understand how to do it.

i try to use 'push' but this is not the way:

QBCustomObject co = new QBCustomObject();
            co.setClassName("image");
            HashMap<String, Object> fields = new HashMap<String, Object>();
            fields.push("array", newComment);
            co.setFields(fields);
            co.setCustomObjectId(ID);

            QBCustomObjects.updateObject(co, new QBCallbackImpl() {
                @Override
                public void onComplete(Result result) {
                    if (result.isSuccess()) {
                        QBCustomObjectResult updateResult = (QBCustomObjectResult) result;
                        QBCustomObject qbCustomObject = updateResult.getCustomObject();
                        Log.d("Updated record: ",qbCustomObject.toString());
                    } else {
                        Log.e("Errors",result.getErrors().toString());
                    }
                }
            });
Was it helpful?

Solution

Try this

fields.put("push[tags][]", "man");
record.setFields(fields);

Push 'man' string to array field with name 'tags'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top