Java – how to query the values of columns set in parse as pointers to other tables
•
Java
I use parse as my application. I want to query a table in which columns are set as pointers to other tables This is a query:
ParseQuery query = new ParseQuery("CategoryAttribute");
query.whereEqualTo("categoryId",categoryId);
query.findInBackground(new FindCallback() {
@Override
public void done(List<ParSEObject> categoryAttributes,ParseException e) {
if (e == null) {
for (int i = 0; i < categoryAttributes.size(); i++){
String atributeCategoryId = categoryAttributes.get(i).getString("categoryId");
String attributeKey = categoryAttributes.get(i).getString("attributeKey");
String attributeValue = categoryAttributes.get(i).getString("attributeValue");
setCategoryAtributeRow(atributeCategoryId,attributeKey,attributeValue);
}
} else {
Log.d("score","Error: " + e.getMessage());
}
}
});
So the categoryid column is a pointer to other tables Other columns work normally I tried to scan the API and guide, but I couldn't find the required solution Help will be appreciated!
Solution
This is the way to solve this problem:
ParSEObject sale = ParSEObject.createParSEObject("Sale");
Then you need to get parseobject from the result:
sale = result.getParSEObject(pointer_field);
Now you can sell in any field, just as you usually do, for example:
sale.getString("some_field")
Note: when you query, if you want to be able to extract data from the query after returning, you must include the pointer field result:
query.include("pointer_filed")
I hope it helps
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
