Hi all,
I’ve searched online and in this forum an answer to this problem,but I couldn’t find one, so I try to ask you.
What I’m trying to do is to extract results from a query, using a script (the example is simple but I would work with more complex queries).
This usually work if i use my default SQL, since I don’t need to specify the db in the “runPrepQuery” function.
But if I do the same thing on a secondary db, I keep having errors
this is the script
db = "NotDefault_DB"
queryString = "SELECT batch_no FROM batches WHERE cat_name = 'Process' and order_no='38'"
results= system.db.runPrepQuery(queryString,db)
this is the error
Traceback (most recent call last):
File "<event:propertyChange>", line 8, in <module>
java.lang.ClassCastException: java.lang.ClassCastException: Cannot coerce value 'NotDefault_DB' into type: class [Ljava.lang.Object;
caused by ClassCastException: Cannot coerce value 'NotDefault_DB' into type: class [Ljava.lang.Object;
Ignition v7.9.2 (b2017041315)
Java: Oracle Corporation 1.8.0_181
If I run the same query on a object or a tag, it works (I can select the secondary db from the dropdown menu)
I’ve tried using also squared brackets etc, but I had just different errors.
I’m probably doing something wrong, but I can’t understand what it is
Any idea?