Hey all, have a little hang up that I'm not sure how to resolve. I am trying to set up a filtering system for a log. Presently, each input field for the filter has a checkbox that will enable or disable that field. Interacting with the checkbox will also alter the query that is run on button press to update the table. To do this, I have created a set of labels to hold each piece of the query, and a final label that simply sums the pieces.
As a result, my query can look like either option below, with any possible combination of AND statements in between:
SELECT * FROM rcp_cleaninglog WHERE 0 = ? AND Reactor = ? AND Product = ? AND Step = ? AND cID = ? AND Initials = ?
SELECT * FROM rcp_cleaninglog WHERE 0 = ?
The same is done for the arguments, as follows:
[0,reactor,prod,step,cid,init]
[0]
I have included the 0 = 0 argument to allow a return of the entire dataset if no filters are applied, and to help with the flexibility (i.e., all actual arguments now require an 'AND' or preceding comma, no argument is "first" in the list, thus the formatting is standardized).
However, there seems to be some disconnect that appears to occur only on the 'arguments' side. When running the following script:
reactor = event.source.parent.getComponent('ReactorSlct').selectedLabel
prod = event.source.parent.getComponent('ProductSlct').selectedLabel
step = event.source.parent.getComponent('StepSlct').selectedLabel
cid = event.source.parent.getComponent('CIDSlct').text
init = event.source.parent.getComponent('InitialSlct').text
filter = event.source.parent.getComponent('QueryTxt').text
arg = event.source.parent.getComponent('ArgTxt').text
ret = system.db.runPrepQuery(filter,arg)
event.source.parent.getComponent('Wash Log').data = ret
The system will return the following error:
caused by Exception: Error executing system.db.runPrepQuery(SELECT * FROM rcp_cleaninglog WHERE 0 = ? AND Reactor = ? AND Product = ? AND Step = ? AND cID = ? AND Initials = ?, , [0,reactor,prod,step,cid,init], ) | |
---|---|
caused by GatewayException: The value is not set for the parameter number 2. | |
caused by SQLServerException: The value is not set for the parameter number 2. |
I have triple checked the component names/links and they all appear to be correct. It is also fully independent of what parameter(s) are chosen to filter by, I have tested each param by itself and with others. The error message above has the full argument contained within it, meaning the query should see each necessary parameter, I am completely unsure why they aren't making it all the way through. My best guess is an issue within the system.db.runPrepQuery(x,y,z) line, maybe a missing argument, but I've formatted the query script itself no different than any other in the past.
Any help on this would be greatly appreciated!
Thanks.