Typed content lambda expression - children could not be evaluated
Hi
Umbraco 7.1.6.
so I'm using a lambda expression to lookup a few nodes but when I try to do a where based on one property value I always get children could not be evaluated.
the foreach does not execute as nothing is returned. When I debug and inspect the lookup into another variable, where I should get a list of published content I get "children could not be evaluated".
Now, if I try
foreach (var productCategory in Umbraco.TypedContent(1115).Children.Where(a => a.HasValue("highlightMapType") ))
this works fine, but still returns unwanted items.
Not sure if it's a bug but the code can see the property, can see that it has a value, but cannot evaluate it. On the later foreach, where I get all items and then I print out the property value separately I get the property perfectly - "Yes" or "No".
Casting the generic type to bool will also give me the infamous children could not be evaluated.
As a last resort I could do an if inside the foreach as I know that I can get the property value, but this would be really inefficient.
Wondering if it's a bug or an issue that you guys have had and there's a small gotcha?
Old post, but i found this while googling for "children could not be evaluated", and found a different solution which I thought might help someone else.
The reason for this error turned out to be that the document cache was corrupted, specifically due to me having changed document type on a document earlier (I love the new option, but I think there might be a bug). I republished the root node, checking "Publish children," and all was OK again.
Typed content lambda expression - children could not be evaluated
Hi
Umbraco 7.1.6.
so I'm using a lambda expression to lookup a few nodes but when I try to do a where based on one property value I always get children could not be evaluated.
code being
the foreach does not execute as nothing is returned. When I debug and inspect the lookup into another variable, where I should get a list of published content I get "children could not be evaluated".
Now, if I try
this works fine, but still returns unwanted items.
Not sure if it's a bug but the code can see the property, can see that it has a value, but cannot evaluate it. On the later foreach, where I get all items and then I print out the property value separately I get the property perfectly - "Yes" or "No".
Casting the generic type to bool will also give me the infamous children could not be evaluated.
As a last resort I could do an if inside the foreach as I know that I can get the property value, but this would be really inefficient.
Wondering if it's a bug or an issue that you guys have had and there's a small gotcha?
Cheers!
Fixed! For some reason, casting the generic type to string made it work. So as a reference for anybody else:
Bizarre as this was my starting point! Oh well, I hope this helps someone else!
Old post, but i found this while googling for "children could not be evaluated", and found a different solution which I thought might help someone else.
The reason for this error turned out to be that the document cache was corrupted, specifically due to me having changed document type on a document earlier (I love the new option, but I think there might be a bug). I republished the root node, checking "Publish children," and all was OK again.
is working on a reply...