DB Parametrized Reader with String Widget


I have a query that takes in multiple where clause which are fed by the user through multiple String widgets. Since the query is like
Select * from table where column1 = $stringwidgetvalue$ and column2 = $stringwidgetvalue2$
However i want a facility where if the user doesn’t give any value in the stringwidgetvalue2 it should take in all the values and basically act as if the column2 = $stringwidgetvalue2$ clause wasn’t even there.
I have tried this with if else but the issue is i have to maintain 2 db parametrized query reader and that doesn’t really work if my conditions under where clause keep on increasing.

Is there any way where i can get this done without adding much nodes or complexity to the flow?

Hi @r_jain -

Can you upload an example of what you’ve tried already? I think this should be doable by separating the logic of building the query from the Parameterized DB Query Reader itself.

How many parameters are potentially needed? Is there a hard limit?

Hey Scott,

Thanks for your response. I figured it out. I used one column to store
select * from table
and then for each filter condition which is being passed by the user i had if else logic implemented to give null if the user doesn’t give any input and "and value = (userinput) and finally i concatenated it all and passed it as a flow variable.

It worked :slight_smile:

1 Like

Excellent! Thanks for posting about your solution.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.