Unable to resolve value of type 'ConstantIndicationT'

Posted by Community Admin on 04-Aug-2018 16:10

Unable to resolve value of type 'ConstantIndicationT' to query node

All Replies

Posted by Community Admin on 11-Mar-2013 00:00

I am receiving the error described in the title when executing the following line:

var schoolTaxon = taxonomyManager.GetTaxa<HierarchicalTaxon>().Where(t =>
    t.Taxonomy.Id == Constants.TeacherClassesTaxonomyGuid
    && t.Name == schoolId.ToString()).SingleOrDefault();

Any ideas? Searching Google for ConstantIndicationT yields no results.

Posted by Community Admin on 24-Sep-2013 00:00

I know this is a bit old, but for others (hopefully)

I have had the same error in Linq queries that produce an IQueryable. In my case, it's because I'm doing comparisons between 2 fields that do not match in type between how they are stored in the database (and must be referenced when an IQueryable) and how they are deserialized into objects (and must be referenced when an IEnumerable). For example, the following fails:

var committeeName = item.GetValue<Lstring>("Title");
var myCollection = DynamicModuleManager.GetDataItems(committeeServiceType).Where(i => i.GetValue<
string>("CommitteeLookup") == committeeName);
if (myCollection.Any()) <=========== FAILS HERE

  logic here

but the following succeeds:

string committeeName = item.GetValue<Lstring>("Title"); <==== note difference
var myCollection = DynamicModuleManager.GetDataItems(committeeServiceType).Where(i => i.GetValue<
string>("CommitteeLookup") == committeeName);
if (myCollection.Any())

  logic here

I believe this is because the "var" in the first is of type "LString", which is how the field is deserialized when converted into an object (IEnumerable, such as in .Any()), but when it carries out the database query (IQueryable) it has to be the same type as what is stored in the db ("string").

I suspect in your example, it's a similar difference between the "Guid" type that exists on enumeration versus the "string" type that is actually used to store the Id in the db.

This thread is closed