Select items where children have specific property
From the following structure I want to select all the countries that have a property (essentialExperiences) set. This property is an embedded content datatype which seems to set it to <data /> when nothing has been set for it.
Main Page --- Continent ----- Country Listing --------- Country
So far I select all the continents and loop through them. In my loop I then have this to select 1 random country that has the essentialExperiences set.
Sorry for the late reply, hope your strill around :)
Dont hang me on this one as I havent tested it.
Embedded Content is a bit wierd in the way it works, but if I remember correctly you can access the date with the property name and .InnerText to get the value.
Select items where children have specific property
From the following structure I want to select all the countries that have a property (essentialExperiences) set. This property is an embedded content datatype which seems to set it to <data /> when nothing has been set for it.
Main Page
--- Continent
----- Country Listing
--------- Country
So far I select all the continents and loop through them. In my loop I then have this to select 1 random country that has the essentialExperiences set.
item.Descendants("CountryPage").Where("essentialExperiences!= \"<data />\"").Random(1);
Nothing seems to be getting selected even though there is one country that has the essential experiences set. Can anyone enlighten me where I'm wrong.
Guess no one knows then :/
Sorry for the late reply, hope your strill around :)
Dont hang me on this one as I havent tested it.
Embedded Content is a bit wierd in the way it works, but if I remember correctly you can access the date with the property name and .InnerText to get the value.
So it ought to be something like this:
item.Descendants("CountryPage").Where("!string.IsNullOrWhiteSpace(essentialExperiences.InnerText)").Random(1);If nothing else, it might give you some new ideas for testing :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.