/// <summary>
/// Add a parameter with a given name and value.
/// </summary>
/// <param name="name">The name of the parameter</param>
/// <param name="value">The value of the parameter as a FHIR datatype or Resource</param>
/// <returns>this (Parameters), so you can chain AddParameter calls</returns>
public SearchParams Add(string name, string value)
{
I am trying to figure out the proper use of the SearchParams.Add
when I have an "OR" on the same search-param-NAME.
Example:
http://hapi.fhir.org/baseR4/Appointment?_count=555&patient=Patient/40a7788611946f04,Patient/113798
To capture this, should I do:
SearchParams sp1 = new SearchParams();
sp1.Add("patient", "Patient/40a7788611946f04");
sp1.Add("patient", "Patient/113798");
Or:
SearchParams sp2 = new SearchParams();
sp2.Add("patient", "Patient/40a7788611946f04,Patient/113798");
Full bread crumb:
namespace Hl7.Fhir.Rest
public class SearchParams
..
<PackageReference Include="Hl7.Fhir.R4" Version="5.11.0" />
The former one is the right /better choice as you can add the values dynamically without concatenating explicitly to achieve your result.
SearchParams sp1 = new SearchParams();
sp1.Add("patient", "Patient/40a7788611946f04");
sp1.Add("patient", "Patient/113798");
But it does not allow to add "or" condition for patient parameters list through the below code execution var result = fhirClient.Search(sp1);
Alternate way
var sp2= new SearchParams();
string[] patientIds = new string[] { "Patient/40a7788611946f04", "Patient/113798", "Patient/783746" };
sp2.Add("patient", string.Join(",", patientIds));
sp2.Add("_count", "555");