How to use multiple filters on aggregated results?

Options

Hello,

I have a database table of airline tickets. On my front end the user can filter the airline tickets by:

  • airline
  • destination country
  • destination city
  • client name
  • traveler name
  • cabin

The user can filter by one of these elements (e.g. airline), or by multiple elements (e.g. airline + destination city + cabin).

So in my endpoint I have these inputs:

The endpoint should return the airline tickets grouped by client_name + aggregated by selling_price (sum). But the result should be filtered by the value of one or more inputs.

I know how to group and aggregate results within a "Query All Records" function, but I can't figure out how to add the filters dynamically, depending on if the input value != ""

I have already tried to use Lambda functions to filter the results, but then I can't group and aggregate the results after the Lambda function anymore…

Does someone have any advice on how to dynamically filter a "Query All Records" results depending on whether one or more inputs has a value?

Thank you!

Best Answer