Filtering nested objects via the typescript bindings

Can I filter on a sub-element ?

For instance the state is a sub-element of the country

object: () => ({country.state: "yourstate", city: "yourcity"})

This currently creates a react error

1 Like

Hi @bartcant, this should be supported. E.g., with a tiny modification to the create-daml-app template to add make the template nested:


data X = X
  with
    y : Int
  deriving (Eq, Show)

template User with
    username: Party
    following: [Party]
    z : X

We can query as follows:

const allUsers = useStreamQueries(User.User, () => [{z: {y: "1"}}], []).contracts;

Note that streams require an array of queries where as the non-streaming endpoint require only a single object.

In your example, it looks like the syntax for defining the Javascript object is off. Try something like

() => ({country: {state: "yourstate"}, city: "yourcity"})
3 Likes