Named Query Gateway Context

Are there any planned updates to the system.db.runNamedQuery() function?

The fact that the code is required to be different in the Client/Designer context vs. the Gateway context is super frustrating as we commonly code in shared or project scripts and these are debugged in the designer, but later executed in the gateway. I understand the need to specify the Project in the gateway context, but can the function be a bit more intelligent and first check the project the script is executing from?

data = system.db.runNamedQuery(system.util.getProjectName(), 'getItemData')

Or, can this function accepted keyword parameters and when called in the Client or Designer context, just ignore the project parameter? Just trying to find ways to make this easier without writing more lines of code for every query just to detect what context I am in.

The implementation in 8.0 works this way now, by chance.

edit: also, if you left out the project param on the gateway call, it would find the appropriate project if there were one.

1 Like

Well thats good news!

I wish this were true, when running a timer script I get NPE without manually adding the project name...

Traceback (most recent call last):
  File "<TimerScript:***/interfaceProductData @14,400,000ms >", line 2, in <module>
  File "<module:project.oracle>", line 13, in load
java.lang.NullPointerException


java.lang.NullPointerException: java.lang.NullPointerException

7.9.9 (b2018081621)
Oracle Corporation 1.8.0_191

Sorry, that only applies to 8.

Ahh… would the below be a bad thing to do in 7.9 as a workaround to keep code clean?

image

1 Like

Yeah, seems fine to me.