Dear grids!

Hi, I have a datasource (it’s a view) with a lot of records. I would like to display in a grid the informations coming from this datasource. BUT I DON’T WANT TO SHOW ALL THE DATA. In my datasource there are the accountName, the name of the client and some informations about all the sales that he has done. So, if I display the contents of the datasource, I have for example: 142 | John Smith | 111 | firstSaleSmith 142 | John Smith | 112 | secondSaleSmith 888 | Peter Cook | 223 | firstSaleCook I would like to display in my grid only the account name and the name of the clients: 142 |John Smith 888 |Peter Cook But I have: 142 |John Smith 142 |John Smith 888 |Peter Cook How can I do to not display 2 times the same line? Thanks, Vince

You have to modify the query a little bit. You have to group your records on the accountName like this: overload the init Method of the datasource and write this code after super(): this.query().dataSourceTable(YOURTABLE).orderMode(OrderMode::GroupBy); this.query().dataSourceTable(YOURTABLE).addSortField(fieldNum(YOURTABLE, accountNum)); and if you don’t want to show the accountName as a display method, you should also write this: this.query().dataSourceTable(YOURTABLE).addSortField(fieldNum(YOURTABLE, accountName)); this should help :slight_smile:

Thanks a lot, It works very well. Just for precision, you wrote: “and if you don’t want to show the accountName as a display method, you should also write this: this.query().dataSourceTable(YOURTABLE).addSortField(fieldNum(YOURTABLE, accountName));” You wanted to say “if you want…” ? because if I don’t put "this.query().dataSourceTable(YOURTABLE).addSortField(fieldNum(YOURTABLE, accountName))" I can’t display the client’s name. So, my code is now: public void init() { QueryBuildDataSource qbds; Query query = new Query(); qbds = query.addDataSource(tablenum(Vue_Clients)); qbds.orderMode(OrderMode::GroupBy); qbds.addSortField(fieldNum(Vue_Clients,AccountNum)); qbds.addSortField(fieldNum(Vue_Clients,Name)); qbds.addSortField(fieldNum(Vue_Clients,City)); Vue_Clients_ds.Query(query); super(); } Vince

No, I meant that normally you would write a display method to show the accountName based on the accountNum. But in your case, if you have it in the table, you can include it into the group fields. :slight_smile: and that’s just what you did.

Thanks for your help!!