I have a named query that updates a table with the results of a QC test. when I run the test in the named query screen all columns update correctly. but when I run the query from a value-changed script. using system.db.runNamedQuery. all the parameters are updated except for one ("FRAME_PIN"). I have confirmed that FRAME_PIN in params object is populated correctly. but the database shows a null for FRAME_PIN.
this is a section of the script.
framePin = str(system.tag.read("[.]FramePin").value)
#logger.info("framePin:"+framePin)
# Prepare the parameters for the named query
params = {
"PRODUCT": "",
"COST_CENTER": costCenter,
"MACHINESEQ": machineSeq,
"SUBSEQ": subSeq,
"WORK_CENTER": "294",
"WORK_STATION": "", # Fill as needed
"OPERATOR": operator,
"TOOL_NO": "", # Fill as needed
"TOOL_SEQ": "", # Fill as needed
"JOB_ID": "", # Fill as needed
"TARGET_VALUE": 1.5, # Ensure numeric values are not quoted
"MAX_TARGET_VALUE": 2.0,
"MIN_TARGET_VALUE": 0.0,
"RESULT_VALUE": gap_measurement_value, # Use value from resultValue
"UOM": "mm",
"MEASUREMENT_TYPE": "Laser",
"TEST_DESCRIPTION": "Disc Gap Measurement",
"STATUS": status,
"FRAME_PIN":framePin
}
# Log parameters and confirm query execution
logger.info("paramas: "+str(params))
try:
system.db.runNamedQuery("RU_Gap_Measurment","QCTOOLDATAINSERT", params)
logger.info("Named query executed successfully.")
except Exception as e:
logger.error("Error executing named query: " + str(e))
I have confirmed the correct data type in Oracle (varchar2), as well as the correct spelling of the parameter in the named query.
this is the named query
`insert into QC_TOOL_DATA
(
entrydate,
PRODUCT,
COST_CENTER,
MACHINESEQ,
SUBSEQ,
WORK_CENTER,
WORK_STATION,
OPERATOR,
TOOL_NO,
TOOL_SEQ,
JOB_ID,
TARGET_VALUE,
MAX_TARGET_VALUE,
MIN_TARGET_VALUE,
RESULT_VALUE,
UOM,
MEASURMENT_TYPE,
TEST_DESCRIPTION,
STATUS,
FRAMEPIN
)
values
(
sysdate,
:PRODUCT,
:COST_CENTER,
:MACHINESEQ,
:SUBSEQ,
:WORK_CENTER,
:WORK_STATION,
:OPERATOR,
:TOOL_NO,
:TOOL_SEQ,
:JOB_ID,
:TARGET_VALUE,
:MAX_TARGET_VALUE,
:MIN_TARGET_VALUE,
:RESULT_VALUE,
:UOM,
:MEASURMENT_TYPE,
:TEST_DESCRIPTION,
:STATUS,
:FRAME_PIN
)`
I am hoping a fresh set of eyes may be able to point out the issue.
thanks