Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to filter Graph Api friends_location that are not empty
    text
    copied!<p>I'm experimenting with the new Facebook project template for MVC 5 in Visual Studio 2013. I've added a Location property to the <code>MyAppUserFriend</code> class to get the location of each friend. I need to filter the location results for friends who have a location. In other words, I don't want to return friends with an empty location field.</p> <p>Below is the method that gets the <code>MyAppUser</code> and <code>MyAppUserFriend</code> results.</p> <pre><code> [FacebookAuthorize("email", "user_photos", "friends_location")] public async Task&lt;ActionResult&gt; Index(FacebookContext context) { if (ModelState.IsValid) { var user = await context.Client.GetCurrentUserAsync&lt;MyAppUser&gt;(); return View(user); } return View("Error"); } </code></pre> <p>Here is the class for MyAppUserFriend. It's my understanding that I can filter the results using the FacebookFieldModifier attribute, but I can't find what field modifiers are available except <code>search?type=location&amp;center=37.76,-122.427&amp;distance=1000</code></p> <pre><code>public class MyAppUserFriend { public string Id { get; set; } public string Name { get; set; } public string Link { get; set; } public FacebookLocation Location { get; set; } public double Distance { get; set; } [FacebookFieldModifier("height(100).width(100)")] // This sets the picture height and width to 100px. public FacebookConnection&lt;FacebookPicture&gt; Picture { get; set; } } </code></pre> <p><strong>Update</strong>:</p> <p>I experimented with FQL statements and was unable to filter the results for location because the <strong>'current_location'</strong> field is not indexable and therefore cannot be used in the <strong>WHERE</strong> clause.</p> <p>I also looked into searches the search queries but these are limited public objects only and it doesn't appear that search queries can be combined with the location parameters and/or FQL statements.</p> <p>Regarding the The field modifiers, they are available on the location object are limited to 'limit' and 'uid' only, so I was not able to user field modifiers to limit the results the way I needed. I was able to find the field modifiers in the graph explorer in case anyone comes across this question in the future.</p> <p><img src="https://i.stack.imgur.com/DllEk.png" alt="enter image description here"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload