Hi Satoshi,
You can dynamically built the query before you execute the database connector. So you create a string variable (Call it StringVariable or whatever you want). And initially fill that with
'SELECT * FROM M_USER'
Then you can do a check if the input field is empty. If not you can change the variable with:
$StringVariable + ' WHERE USER_CD = ' + $Entity/AttributeName
Then in the Database connector you can fill the variable $StringVariable in the sql property.
If the input field is filled, it will use the WHERE Statement, if it is empty, it will select everything.
Hi Satoshi,
If I understand your question correctly, you are looking for Parameterized Query
If not, Can you please elaborate your use-case ?
Hi Surabhi Saraf.
Thank you for answering the question.
What I want to achieve is to dynamically add a conditional statement in the Where clause.
●Case.1
If there is no input in the search conditions, I want to search all items.
The SQL to be executed is as follows. Search all records without specifying WHERE clause.
SELECT * FROM M_USER
●Case 2.
If there is an input in the search condition, specify the condition in the WHERE clause.
The SQL to be executed is as follows. Specify User Code as a search condition.
SELECT * FROM M_USER WHERE USER_CD = '0000000001';
I want to realize the above with Database Connector. If you know how to do it, please answer.