2

I have a Query that the datasources it is set to can change dynamically. I want to take the results of this Query and bind that to a Grid, so each time it may have new fields, and data.

I already added a Grid to my form, and added the Common table as a datasource. I tried to set the dataSource of the grid, and iterate through the fields and dynamically add them, but no data is showing up.

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
esac
  • 24,099
  • 38
  • 122
  • 179

1 Answers1

2

Have a look on the form SysTableBrowser. It builds the grid based on a tableId.

Maybe you can change SysTableBrowser to accept a query.

Good luck!

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
  • Yes, that was where I started. It accomplishes it very differently by using the compiler to compile the query you type into the text box below. I can not seem to get the query from the Query object (in a format that will compile) so I do not think that will work. – esac Mar 05 '12 at 22:46
  • You should be able to change the auto-generated query to your instead. Do so in the `init` method of the datasource: this.query(yourquery); – Jan B. Kjeldsen Mar 06 '12 at 09:08
  • Ok, so after a lot of research, yes this does what I want. I got it working, but now it is just an issue of trying to figure out how to display the results in a format that makes sense, as the Query will have multiple tables, where the table browser does not. – esac Mar 08 '12 at 04:58
  • If you have inner joined the tables, you should be able to display all the fields in the grid. But would the end result make sense to the user? – Jan B. Kjeldsen Mar 08 '12 at 07:46