0

I have something like this

    ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("MyTable");
    query.include("tag");
    query.findInBackground(new FindCallback<ParseObject>() {
        public void done(List<ParseObject> objectList, ParseException e) {
            if (e == null) {
                for(ParseObject objects : objectList) {
                    Log.d(TAG, "parse object name : " + objects.getString("name"));
                    Log.d(TAG, "tag name : " + objects.getString("tag"));
                }
            }
        }
    }

for each row, I have columns like String name and Pointer<Tag>.

enter image description here

In LogCat, it prints out names correctly, but it prints out null for each tag.

parse object name : Events
tag name : null

I don't actually need to get pointer, but all I need is to get the tag in String format (I can't modify the table to make the column String now).

What can I do to be able to get the Pointer as String format?

1
  • 1
    u cant to fetch like on this way pointer as a string is not possible in parse database. Commented Feb 22, 2016 at 18:29

3 Answers 3

1

Use this to get value from pointer.

ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("MyTable");
query.include("tag");
query.findInBackground(new FindCallback<ParseObject>() {
    public void done(List<ParseObject> objectList, ParseException e) {
        if (e == null) {
            for(ParseObject objects : objectList) {
                Log.d(TAG, "parse object name : " + objects.getString("name"));


                ParseObject tagObject=objects.getParseObject("tag");
                //Now access your tag class column
                Log.d(TAG, "tag name : " + tagObject.getString("columnName"));

            }
        }
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

I dreamed about it because I was thinking so hard overnight. All of a sudden the purpose of the pointer made all sense, and looking at this answer made everything clearer. It's working like a charm. Thanks.
1

Try on this line code for log

 Log.e(TAG, "tag name : " + objects.getParseObject("tag").getString("col_name");

this way to fetch parse pointer object.

Comments

-1

To read value of a pointer,read it as a parse object.

 Log.d(TAG, "tag name : " + objects.getParseObject("tag"));

Note: When you are doing your query you must to include the pointer field if you want to be able to extract the data from it after the query will be returned. The result:

query.include("pointer_filed");

1 Comment

-1 because this one will print out the object id (not objectId from Parse, but from java). Also second half of your answer is a direct copy from someone else's answer. :p

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.