So i want to be able to pull data based on a certain condition, from this data i then want to be able to print multiple items from this query...here's what ive done so far:
def rec():
qe = JsonQ(r"C:\ShopFloor\data.json")
res = qe.at('data').where('Status', '=', 1).get()
for Process, Shortnum in res:
print(Process['Process'] + " " + Shortnum['Shortnum'])
rec()
this is from the following json file:
{
"data": [
{
"Shortnum": "34567",
"Process": "SPA",
"Status": 1,
"Start_Time": "2016-12-14 15:54:35",
"Finish_Time": "2016-12-14 15:56:02"
},
{
"Shortnum": "34567",
"Process": "Figure",
"Status": 0,
"Start_Time": "2016-12-08 15:34:05",
"Finish_Time": "2016-12-08 15:34:09"
},
How can I get this to work properly? Ideally I am looking for this kind of response from the print:
SPA 34567
cannot get a current output, i get this error... i realise I am passing too many arguments however i couldn't think of a proper way to do it...
Exception has occurred: ValueError
too many values to unpack (expected 2)
File "C:\ShopFloor\main.py", line 101, in rec
for Process, Shortnum in res:
File "C:\ShopFloor\main.py", line 106, in <module>
rec()