fulcrumapp/fulcrum-js

Add query to records.all() function.

Closed this issue · 2 comments

In your docs for the records.all function it states : The options object will be converted to query string parameters and properly url encoded.

How is it possible to add a Where clause for example to the options of this function.
For example:

new Promise((resolve, reject) => {
  fulcrum.records
    .all({
      form_id: 'abc-123',
      where: 'form_values[1234]="Matched"',
      OrderBy: 'ascending'
    })
    .then(page => resolve(page.objects))
    .catch(reject)
})

I am aware of the query portion of this package but i need to access child records and they aren't bundled with the parent records like they are when you use records.all().

Is something like this possible or have I miss read the docs.
Thanks

Making progress.
I can query parent level elements like follows:

new Promise((resolve, reject) => {
  fulcrum.records
    .all({
      form_id: 'abc-123',
      project_id: '12098123-eXamp13-12309c0183hc'
    })
    .then(page => resolve(page.objects))
    .catch(reject)
})

Haven't figured out how to do so for elements within the form_values child component.

Yeah, the only way to query/filter any specific field values is to use the Query API. You'd have to query the base form with the Query API and then get any child records with a subsequent Query API call.