How to get the ranges of a datasource?

Hi, I have a form with a grid. I would like to know how I can get the ranges of this grid after making a filter on a field for example. eg.: The grid looks like: 1 | Peter | New York 2 | John | New York 3 | Will | Las Vegas The user decide to make a filter (by clicking with the right button of his mouse) on the city “New York”. So now the new grid is: 1 | Peter | New York 2 | John | New York I would like to get/display the value “New York” . Maybe it’s with the findRange() method but it doesn’t work. Thanks. Vince

Hi Vince, I have the same problem. Please take a look at topic “Find and Filter on FormDataSource”. I am thinking that maybe there is a system class specialized to tell this. I will have some detailed tests and let you know. Regards, Ciprian

Ok, I have read your topic and I don’t know why but if I try to override the filter() method it doesn’t work. eg.: public void filter(str _filterStr) { print “before”; pause; super(_filterStr); print “after”; pause; } This is just a test to see if the method is called and nothing appens. I’m gonna search a little bit more… If someone in the world can help us … Vince

Don’t know if this is what you are actually looking for, but if you overload the executeQueryMethod of your datasource and write this code, it will output all the values of all the ranges and the names of the fields with the ranges: public void executeQuery() { int i = 1,j; ; super(); info(this.queryRun().query().dataSourceNo(1).toString()); j = this.queryRun().query().dataSourceNo(1).rangeCount(); while (i <= j) { info(this.queryRun().query().dataSourceNo(1).range(i).name() + " = " + this.queryRun().query().dataSourceNo(1).range(i).value()); i ++; } }

Thanks a lot!!! Your very good, it’s the second times that you give me the good solution. Thanks, Diakuiu! (I hope the translation is correct…)

Anytime. Well, yes, it is. :slight_smile:

A different approach would be if you create a “filter” group on the form. The idea is to place the potential filter fileds directly on your form. This way the user can select the values directly from the form and not through the filter dialog. By overwriting the modified method of the filter control, you can detect when a filter value is selected and decide what to do with the selection. The filter values will be accessible from any place within the form by just checking the .Text property of the filter box. A good example is the “smmBusRelTable” Form in the CRM module. Another example is “CustCollectionLetterNote”.

quote:

Ok, I have read your topic and I don’t know why but if I try to override the filter() method it doesn’t work. eg.: public void filter(str _filterStr) { print “before”; pause; super(_filterStr); print “after”; pause; } This is just a test to see if the method is called and nothing appens. I’m gonna search a little bit more… If someone in the world can help us … Vince
Originally posted by vince - 2005 Apr 19 : 16:39:27

Wel Vince, it seems that it was someone… Nice catch, Ivan [8D] Cip