Advanced Searching with _filter
# support
s
How to use the
in
operator? what should be the expected format of the right-hand side operand? Sorry If this is documented somewhere but I can't find it by searching through the docs.
r
s
thanks for the links but they don't have expected format for the right hand side operand for
in
. would be great to clarify that.
I've tried both format
'id in "1, 2"'
and
'id in [1, 2]'
both aren't working
r
oic - the expected use is for a valueset, for example await medplum.searchResources('DiagnosticReport', { _filter: 'code in "http://loinc.org"', });
s
Thanks! I have multiple values in the valueset, should I put them in the operand string? do we use comma to saparate values?
r
yeah, put a single valueset in the string - but multiple comma separated is not currently supported
r
@s_w_abc - you can find the official documentation of the _filter parameter here: https://hl7.org/fhir/R4/search_filter.html
what is search behavior you're intending? If you are just checking that a value test value is in the list of values,
in
is not appropriate here. You can just use the "or" search syntax here: https://www.medplum.com/docs/search/basic-search#searching-multiple-criteria For example, the
_filter=name eq Marge,Homer
The
:in
modifier has a very specific meaning in FHIR - it refers to a value being included in a valueset
s
Thanks @rahul1 , this is really helpful, maybe I can use the
or
to search for a list of `id`s
r
s
ohh
_id
is even better!! I skipped
_id
when reading the doc because I assumed it only allows to search for one specific id! what do you think if we add a yellow
info
box to certain sections that can be misread by the reader.
r
we're happy to take suggestions on the docs if it would make things clearer!