I have a block list of Points of Interest (POI). Each POI has a name, url, category, address. I want to filter the blocklist by category. Is this possible? How?
I've tried a bunch of different ways. This is the closest I've gotten, but it doesn't work.
var POIlist = content.PointsOfInterest.Select(x => (CPoi)x.Content);
var POIfood = POIlist.Where(x => x.Value<string>("category").Contains("food"));
With this code POIfood is empty. Should contain 3 items of type CPoi.
@JulienKulker I actually started with x.Category.Contains, but that threw an error. Lemme get that error message for you...
'CPoi' does not contain a definition for 'Category' and no accessible
extension method 'Category' accepting a first argument of type 'CPoi'
could be found (are you missing a using directive or an assembly
reference?)
var POIlist = content.PointsOfInterest.Select(x => (CPoi)x.Content);
var POIfood = POIlist.Where(x => x.Category.Contains("food"));
NOTE: CPoi is an element type that has Category as an attribute (dropdown list property editor). Also, due to models builder Category comes up in intellisense. The code feels right, but it's throwing that mean ole error!
I got it working. User error on my part...I had to rebuild after creating my CPoi. I thought I'd already done that. Color me embarrassed. Thanks for your replies @Dave & @Julien
How to Filter Block List Items
I have a block list of Points of Interest (POI). Each POI has a name, url, category, address. I want to filter the blocklist by category. Is this possible? How?
I've tried a bunch of different ways. This is the closest I've gotten, but it doesn't work.
With this code POIfood is empty. Should contain 3 items of type CPoi.
Hi bh,
Can you try below if i am correct you are using the modelsbuilder so below is a example:
Tested above code so this should work. For you the coude would look something like this
Let me know if it worked. It should work
@JulienKulker I actually started with x.Category.Contains, but that threw an error. Lemme get that error message for you...
NOTE: CPoi is an element type that has Category as an attribute (dropdown list property editor). Also, due to models builder Category comes up in intellisense. The code feels right, but it's throwing that mean ole error!
Hi bh,
What kind of property editor is category on your POI item.
Dave
@DaveWoestenborghs Dropdown list.
Hi bh,
What are the values of the Dropdownlist.
Dave
I got it working. User error on my part...I had to rebuild after creating my CPoi. I thought I'd already done that. Color me embarrassed. Thanks for your replies @Dave & @Julien
is working on a reply...