Good morning.
I am attempting to use note templates.
i have the following defined:
modem_template = {"seq":11, "pressure":12.1, "runcycles":12, "faults":12, "mode": 11, "temp": 12.1 }
req = {"req" : "note.template"}
req["file"] = "vstdata.qo"
req["body"] = {"data" : modem_template}
rsp = card.Transaction(req)
print(rsp)
then in my loop, I am attempting to concatenate 4 records with:
data_to_store = {key:cont[key] for key in ['seq','pressure','runcycles','faults','mode','temp']}
modem.append(data_to_store)
if cont['seq'] == 3:
req = {"req" :"note.add"}
req["file"] = "vstdata.qo"
req["sync"] = True
req["body"] = {"data" : modem}
rsp = card.Transaction(req)
print(rsp)
pprint(modem)
modem = []
cont['seq'] = 0
else:
cont['seq'] = cont['seq'] + 1
I get the correct data:
[{'faults': 196,
'mode': 0,
'pressure': -0.14,
'runcycles': 20108,
'seq': 1,
'temp': 0.0},
{'faults': 196,
'mode': 0,
'pressure': -0.14,
'runcycles': 20108,
'seq': 2,
'temp': 0.0},
{'faults': 196,
'mode': 0,
'pressure': -0.14,
'runcycles': 20108,
'seq': 3,
'temp': 0.0}]
but when I print(rsp), I get:
{'err': 'error adding note: object expected because of template'}
I also tried just setting my template to:
req["body"] = modem_template
and got:
{'err': 'error adding note: body fields not found in template: data'}
as my error.
I feel i’m close, but 'm just spinning my wheels at this point.