Filter by date

46 views
Skip to first unread message

Rizwan Zahid

unread,
Nov 1, 2016, 9:27:05 PM11/1/16
to ObjectPath
 Hi Guys !

I am trying following code but it is returning me no records ,any idea why ?


    response ={ "Source" : {
                "Invoice": [{
                    "Id": "130",
                    "DueDate": "2014-09-10",
                    "TotalAmt": 362.07,
                    "Balance": 362.07
                },
                {
                    "Id": "132",
                    "DueDate": "2014-07-08",
                    "TotalAmt": 300.07,
                    "Balance": 300.07
                },
                {
                    "Id": "133",
                    "DueDate": "2014-06-10",
                    "TotalAmt": 312.07,
                    "Balance": 312.07
                }
                ]
                }

            }
        tree = Tree(response)
        today = datetime.date.today()
        print(tree.compile("$.Source.Invoice[date(DueDate) > date([2011, 4, 8])]"))
        result = tree.execute("$.Source.Invoice[date(DueDate) > date([2011, 4, 8])]")
        for entry in result:
            print (entry)


Reply all
Reply to author
Forward
0 new messages