Running an infopart query through X++

I have a form with a tree item representing two tables. A property and a list of sub properties. What I was wondering is would it be possible to setup a form that shows the subrproperty in an infopart depending on the subproperty tree item selected?