Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hello coders,
Hit a weird discrepancy in FQL (Facebook query language). The facebook developer's site is really unorganized and I'm having trouble finding an answer. The sample code for the Facebook SDK demonstrates FQL with this code:
C#
var query = string.Format("SELECT uid,name,pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1={0}) ORDER BY name ASC", "me()");
	FacebookClient fb = new FacebookClient (userToken);

	fb.GetTaskAsync ("fql", new { q = query }).ContinueWith (t => {
		if (!t.IsFaulted) {
			var result = (IDictionary<string, object>)t.Result;
			var data = (IList<object>)result["data"];
			var count = data.Count;
			var message = string.Format ("You have {0} friends", count);


This pops up a little alert that shows how many friends the current user has. Simple and easy right?
Well, I changed the query to look something like this-
C#
var query = string.Format("SELECT flid, name, type FROM friendlist WHERE owner={0} ORDER BY name ASC", "me()");

And even though the return data appears to be in the same format, The count returns zero every time. Im stumped.
This step is only being used for debugging purposes. Eventually I plan on filling a spinner with the user's friend lists. Can do that until I figure out how to extract this data. Any help would be hot. Thanks.
Posted
Comments
Richard C Bishop 28-Mar-13 14:55pm    
What is "me()"? You are setting that as your value in the where clause to check for owner and uid1 in your select statements.
Member 9950199 28-Mar-13 15:24pm    
me() is a function built into FQL to return the current userID. It needs to be passed through the query. The example I posted demonstates a working query. Still stumped.
Richard C Bishop 28-Mar-13 15:28pm    
I agree with Sandeep, if me() is a method, it needs to be passed as such and not as a string value, unless it is used in the database.
ZurdoDev 28-Mar-13 16:57pm    
What is "me()"? Proper English would be "Who am I?" You're welcome. :)
Richard C Bishop 28-Mar-13 16:58pm    
Lol, nice.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900