Hello Perk,
Great, if you have Snowflake you can use the "LIKE ANY" operator in the SQL statement, which simplifies things.
Are you familiar with parameters and calling modules/projects? These concepts appear in the following solutions.
Solution A: Values you want to query are always found at the end of the string
Values always at the end.morph (11.1 KB)
In this project we have two modules: "Main" and "Run Query".
-
In "Main" we have the Multiple choice parameter "Values to query", from where we can choose the values.
In this module we are building the query condition which we will pass to the "Run Query" module as a parameter. The first step is to list the value of the parameter "Value to query" in the workflow and modify it until we have the condition we need (you will see that we're always adding the "%" in the same position). The last step is to run the "Run Query" module, passing the first value of the column "LIKE ANY condition" to the parameter "LIKE ANY condition" in the "Run Query" module:
-
The "Run query" module has a single action, "Import from database", and in the query editor, there is a Custom SQL condition added, and its value is the parameter that is being sent from the "Main" module. This custom SQL condition can be combined with other conditions that you may have in the visual editor. You will have to choose your Snowflake connector here and the relevant table. This queries the database with the LIKE ANY and brings back the result to the "Main" module.
Solution B: The placement of the values varies (dynamic)
Placement varies (dynamic).zip (9.5 KB)
In this case, we have a helper Excel file, where you have the values to find, and in which position they are found ("At the end", "At the beginning", "Anywhere"):
The morph project structure is the same, with two modules: "Main" and "Run Query". The difference is that in this case, instead of having a multiple choice parameter in "Main", we are opening the Excel file and then building the condition, which we then pass to the "Run Query" module.
In this case we use the Rule action to add the "%" in the right position:
And then we continue building the condition until it's ready to be sent to the "Run Query" module. In this case, the query has the "%" added at different positions, depending on what we have specified in the Excel file. For example:
"AUSP_INTERNAL_CHARACTERISTIC" LIKE ANY ('%11','12%','%13%')
Let me know if you have any questions or if something is not working.