Query a buffer with 0, 1, or more parameters

I have an interesting problem I am trying to solve. I set up an API that can handle 0, 1, or more parameter values. The data from the API will be used to query a buffer and return the results. I am trying to figure out how or what the best route is to query/lookup the buffer to return the correct results.

So the API has three possible parameters: city, postal code, and languages. The API could supply a value for zero, one , two or all three of the parameters. It depends on what the end user is opting for.

The parameters would then be used to find the matching records in a buffer and return a small number of pre-identified record fields to the API. All three parameter fields are strings and the parameters would not necessarily have to be a full 1:1 match. Languages would be a semicolon separated string (ex: “French;Spanish;Vietnamese;”).

Ex: If city parameter = New, then any city with “New” in the name, like New York City, would be returned. The same would go for postal code.

If the user executed the API and only opted for language=Spanish, leaving the other two parameter fields blank, the buffer would identify the records where Spanish is in the language field. If there are other languages included in the record they would be ignored as Spanish is a match. (See example string for languages above). The language match could exist anywhere in the string.

If the user executed the API and opted to search for language=Russian and city=Miami, then the buffer would be filtered on two of the three parameters and ignore the language parameter.

I tried a few different iterations in trying to get this to work. My initial experiment was to collect all three parameter values and have three sequential sub-flows each checking the status of a parameter. Each sub-flow would be specific to one of the parameters. If the parameter condition = true it would filter the buffer based on the parameter otherwise it would return the existing buffer to the next sub-flow with no additional filtering being performed. However, I ran into an issue with the sub-flow records either not being filtered or not being returned to the main flow prior to the next sub-flow.

I’m sure there is a better way to build this.

Thanks.

Mark

Here is the current iteration of the flow. I pared it down to only deal with one parameter for now. After I get it working I will go back to tackling additional parameters.

It starts with a record generator that sets a blank object with two fields, zipcode and city.
image

Next is the condition step. The upper route checks for undefined or null values in the parameter.
image

The lower route checks the inverse.
image

Depending on which route is taken, the buffer query step executes the SQL statement. The only difference is the lower route has the where clause.
image

From there I hoped to have the data return to the parent flow to continue processing but only one record shows in the post condition calculator step.

The value is a debug field set to the zipcode parameter which I established before the conditional flow.

I have tried many different permutations on the return value settings. The only way I got things to return was to map it to a new field via “Add to Record as”. Unfortunately that gave me two fields, one being an array of values from the buffer query and the other being the singular debug field.

Hi Mark,

Thanks for the screenshots and information.

Can you please add me on the org and email me the solution name and flow name to do further testing. My email address is navessa@synatic.com .

Kind Regards,