How to use different SQL queries in DB Query Reader in one flow depending on the value of the input variable?
Sounds like you need a CASE Switch Start upstream of your different DB Query Readers, which can be configured to branch based on the value of the incoming flow variable.
Do you have a bit of your workflow you can post demonstrating what you’ve tried so far?
Exactly, the problem is that I don’t know how to connect Case Switch Start with DB Query Reader and built-in database queries in various forms. Or maybe another node should implement this connection? I use the scheme at work, so I can’t publish it. Generally, it is about the performance of the SQL query and the separation of these queries due to the value of the parameter
@pszpadro you could take a look at these examples. Maybe you can describe your task in more detail and possibly provide an Example with a local database like SQLite or H2 so we would be able so provide a working example.
First Oracle Connector,second depending on the variable, e.g. NAME1 =‘Jogi’ execution of the query version 1 and in the case of MAME1=‘Bubu’ version 2 performed in the DB Query Reader node
What about something like this as a very general framework?
You’ll need to alter the ports of the CASE Switch Start node by clicking on the three dots in the bottom left hand corner, and change them to flow variables. Then update the logic to choose which branch to take.
@pszpadro from your description it could look something like this. Based on a query from the database a decision is made to take the ‘road’ of either Bubu or Jogi and continue afterwards.
The Case Switch node is very flexible.
You can combine a wide range of input and output ports and decide the port number (starting with 0) with the help of Flow Variables.
The two streams can be separated and the end could just be to bring the Flow Variables back together. Just keep in mind: the in-active part will not execute so you will have to plan for that and decide at which point to continue in the normal flow.
Thank you, J will try to use this flow diagram
Thank you, I checked - it works
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.