SmokerJones
SmokerJones

Reputation: 333

BreezeJs query with nested objects

I would like execute the following query:

let query = EntityQuery.from("ResearchApplication")
                       .where("Deleted", FilterQueryOp.Equals, false)
                       .where("ResearchApplicationFiles.FileInformation", FilterQueryOp.Any, "Deleted", FilterQueryOp.Equals, false)
                       .expand("ResearchApplicationFiles")
                       .expand("ResearchApplicationFiles.FileInformation")

ResearchApplicationFiles.FileInformation constains a list of FileInformation and I would like to filter that list where "Deleted" is false.

I keep getting this exception:

The parent value for a property access of a property 'FileInformation' is not a single value. Property access can only be applied to a single value.

How can I get this to work?

Upvotes: 2

Views: 171

Answers (1)

Steve Schmitt
Steve Schmitt

Reputation: 3209

I think you want

EntityQuery.from("ResearchApplication")
    .where("Deleted", FilterQueryOp.Equals, false)
    .where("ResearchApplicationFiles", FilterQueryOp.Any, "FileInformation.Deleted", FilterQueryOp.Equals, false)
    .expand("ResearchApplicationFiles")
    .expand("ResearchApplicationFiles.FileInformation")

Note the change in the Any clause.

See more examples on the Breeze query examples page

Upvotes: 2

Related Questions