views:

164

answers:

1

Hi,

I got an exception in Vici.CoolStorage 'Unable to cast object of type 'System.String' to type 'QueryExpression' when using the following filter on the .List() method of my Event class:

Event.List("has(Resource where has(Teams where TeamID = @TeamID))", 
                "@TeamID", teamID);

-> Event - Resource = ManyToOne relation (Resource property)

-> Resource - Team = ManyToMany relation, plural=true (CSList Teams property)

I want to retrieve all Events with a Resource that belongs to the specified Team (teamID). Is this possible in the Vici.CoolStorage filter syntax?

ps. teamID = Guid

A: 

The has() function should only be used with *ToMany relations. I think you mean this:

I suppose you want to select all records that have a related resource beloning to a specific team?

This could be what you're looking for:

Event.List("has(Resource.Teams where TeamID = @TeamID))", 
            "@TeamID", teamID);
Philippe Leybaert