Search code examples
facebook-c#-sdkfql.multiquery

How do I merge two queries using the Facebook SDK in C#?


I am using Facebook C# SDK but there is not an overloaded method to pass in two queries as parameters. How can I merge two queries?

My Queries like this I have two Queries one is retrieving Name and second is retrieving Message so I want to show name and message to my application but the FQL deosn't support join and all so how I can do this eg.

var Query1 = fbApp.Query("SELECT uid, name, pic_square FROM user WHERE uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())");

var newsFeed = fbApp.Query("SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0");

how I can get result name--> message. Thanky you..!!


Solution

  • I use multiquery in my application. What you do is pass a string[] array into the .Query() command.

    "SELECT uid, page_id, type  FROM page_admin WHERE uid = " + id
    

    and

    "SELECT uid, read_stream, status_update, photo_upload, publish_stream, offline_access FROM permissions WHERE uid IN (SELECT page_id FROM #query0)"
    

    You don't get to name the queries, they come prenamed via the C# API. Note it's #query0, #query1, etc...

    When you get the data back, here's how I parsed it:

    var pageAdmins = multiqueryResults[0].fql_result_set;
    var permissions = multiqueryResults[1].fql_result_set;