Hi, I am the new face for json and I want to ask something about this, anyway, here is my code:
for key in result1date.keys():
key = sorted(result1date.keys())
currentdate = key
print currentdate
result1 = firebase.get('/Rooms/Room1/' + currentdate + '/Inspection/Scan-in/Inspector/', None)
result2 = firebase.get('/Rooms/Room1/' + currentdate + '/Inspection/Scan-out/Inspector/', None)
print result1
print currentdate
for key in result1.keys():
inspector = key
timeout = result2[inspector]["Time"]
result1datetime = firebase.get('/Rooms/Room1/'+ currentdate +'/Inspection/Scan-in/Inspector/'+ inspector +'/', None)
for key in result1datetime.keys():
key = sorted(result1datetime.keys())[-2]
time = key
print time
print time
ch1 = result1datetime[time]["Checklist"]["Entrance louver clean and dust-free"]
ch3 = result1datetime[time]["Checklist"]["Appearance door surface- in good condition"]
ch5 = result1datetime[time]["Checklist"]["Eye viewer and fire escape plan in order"]
ch6 = result1datetime[time]["Checklist"]["Privacy Sign or Make Up Room Sign"]
ch8 = result1datetime[time]["Checklist"]["Switches at the entrance working correctly"]
RESERVED FOR DOOR IN WORKING CONDITION
ch10 = result1datetime[time]["Checklist"]["Lights in working order"]
ch11 = result1datetime[time]["Checklist"]["6 Hangers?"]
ch12 = result1datetime[time]["Checklist"]["2 bathrobes?"]
ch13 = result1datetime[time]["Checklist"]["2 pairs of slippers?"]
ch14 = result1datetime[time]["Checklist"]["1 set of iron and board?"]
ch15 = result1datetime[time]["Checklist"]["Elsafe open or working?"]
ch16 = result1datetime[time]["Checklist"]["1 set of laundry list and bag?"]
ch17 = result1datetime[time]["Checklist"]["1 extra pillow with pillow cover?"]
ch20 = result1datetime[time]["Checklist"]["Luggage bench fabric top is clean"]
ch24 = result1datetime[time]["Checklist"]["2 coke, 2 sprite, 1 C2 lemon, 1 C2 apple, 1 pineapple juice, 1 orange juice, 1 mineral water, 2 San Mig light, 2 pale pilsen?"]
ch25 = result1datetime[time]["Checklist"]["1 pringles, 1 cashew nut, 1 cup noodles (placed in the coffee tray on the writing desk)?"]
ch26 = result1datetime[time]["Checklist"]["Fridge is cold and clean"]
I have three dates. 'currentdate', so I stuck with them, hoping to get the same result, but three of them with different dates. Here is my firebase structure:
( https://i.stack.imgur.com/DfYSP.png )
But I only get one. when I looped all the keys using this part of the code
for key in result1date.keys():
key = sorted(result1date.keys())
below should follow the below. Any help is appreciated. I want to know why this is happening and hopefully a solution or suggestion.
I want to get the output of something like this:
[DATE 1 HERE with all the details within its branches]
[DATE 2 HERE with all the details within its branches]
[Date 3 HERE with all the details within its branches]
source
share