I'm using a script to execute a named query. One of the parameters to the named query is a string. I've tested the named query and it works fine. But when I execute from a script, one of the fields does NOT get populated, but is left NULL.
I am guessing my syntax is not right when I'm building the parameter list, because the field that is NOT being populated happens to be the only "string" parameter ... but I couldn't find any reason why it would not get passed in properly to the runnamedquery method.
hrbyhrKey = 36
losttime = 15
freeform = "freeform text 55"
lossKey = 14
workcellKey = 15
paramlist = {"FreeForm":freeform,"HrByHrKey":hrbyhrKey,"LossKey":lossKey,"LostTime_Mins":losttime,"WorkcellGroupMemberKey":workcellKey}
results = system.db.runNamedQuery(path=namedquerypathvalue, parameters=paramlist, getkey=1)
print results
Are you sure your parameter names match your query definition exactly, including case?
1 Like
Tips:
- Don't post code as a quotation ". Post it as preformatted text </>. Please see Wiki - how to post code on this forum.
- Add a space after every punctuation (
,
and :
) as you would in written English, and both sides of =
. This will help when text needs to wrap and improve general legibility.
hrbyhrKey = 36
losttime = 15
freeform = "freeform text 55"
lossKey = 14
workcellKey = 15
paramlist = {"FreeForm": freeform,
"HrByHrKey": hrbyhrKey,
"LossKey": lossKey,
"LostTime_Mins": losttime,
"WorkcellGroupMemberKey": workcellKey
}
results = system.db.runNamedQuery(path = namedquerypathvalue,
parameters = paramlist, getkey = 1)
print results
2 Likes
I sure did think I had checked all that ... but ... I missed one ... FreeForm, Freeform ... so that was the reason, NOT because it was a string. Thanks for the help.
1 Like
Yeah something like that I would shut the computer off for the weekend lol
Ask me how I knew to check that first thing 
Been there, done that.
3 Likes