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