Question

I have a strange problem with a FQL multiquery

This is my query:

NSString *query =
        @"{"
        @"\"events_info\":\"SELECT name, description, pic_small, pic_big, eid, venue, location, start_time, end_time, timezone, update_time, not_replied_count, privacy, has_profile_pic, version, can_invite_friends, is_date_only, hide_guest_list, host, creator, all_members_count, attending_count, not_replied_count , declined_count, pic_cover FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND start_time > '2013-03-03T00:23:00' OR uid = me())\","
        @"\"event_venue\":\"SELECT name, type,page_id, location FROM page WHERE page_id IN (SELECT venue.id FROM #events_info)\","
        @"\"event_creator\":\"SELECT name, page_id, type FROM page WHERE page_id IN (SELECT creator.id FROM #events_info)\""
        @"}";

This query sometimes does not work... I do not understand what's wrong. When not working, if I delete the third query (event_creator) everything works.

ERROR:

Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xaab6c50 {com.facebook.sdk:ParsedJSONResponseKey={
    body =     {
        "error_code" = 1;
        "error_msg" = "An unknown error occurred";
    };
    code = 500;
}, com.facebook.sdk:HTTPStatusCode=500}
Was it helpful?

Solution

In the first query, you want to retrieve:

  • the page of the event creator,
  • the page of the venue to this event.

What you get looks like:

{
    "venue": {
        "id": 421431217881031
    }, 
    "creator": 844413621
},

In the second query you get the information of the venue's page as such: WHERE page_id IN (SELECT venue.id FROM #events_info). This is very well done because you indeed need to look after the ID of the venue into the venue array.

In the third query, creator is not an array anymore! It represents a page ID (or a user's, but that's not a problem because they are going to be filtered). In that case, you can get the ID directly:

WHERE page_id IN (SELECT creator FROM #events_info)

instead of

WHERE page_id IN (SELECT creator.id FROM #events_info).

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