added the query for the tree grid