0

I was wondering if it is possible to use (custom) relative date filters with the api?

For instance to find all participants of events in the current or last fiscal year.

Would save me a lot of trouble :-) Thanks fort thinking along!

2

Not sure what you mean by "custom" relative date filter, but if you're looking for filtering the results just like we have on the "Find Participant" form, then yes, looks like it is possible.

Eg - To find all participants registered in this fiscal year can be retrieved via -

enter image description here

i.e, select Other in the Parameter dropdown and enter participant_register_date_relative in the textbox as shown above.

The API that will be formed is -

$result = civicrm_api3('Participant', 'get', [
  'sequential' => 1,
  'participant_register_date_relative' => "this.fiscal_year",
]);

Similarly, for Previous Fiscal Year, enter previous.fiscal_year in the value field.

  • By custom I mean for core & custom date fields. Would this also work for other core date fields and custom date fields? Further: what would be the best place in the dev api section to document this? – Richard van Oosterhout Aug 26 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.