Refreshing Grid through filter

We are facing a problem in Axapta Implementation. The problem is mentioned below : We are trying to filter the records displayed in a grid on a form .The executeQuery method of Datasource (overridden) successfully picks up the records to be displayed in the Grid. However, the Grid data is not being refreshed with the result of excuteQuery() . I guess we are not able to connect the query result with the Grid . Any guidance would be of great help. Thanking You

Hi, After executeQuery(), try to use refresh() method. HTH, Harish Mohanbabu

quote:

Hi, After executeQuery(), try to use refresh() method. HTH, Harish Mohanbabu
Originally posted by Harish - 2004 Nov 05 : 10:31:31

Hi, Here’s the code that we are using but it is still not refreshing the grid data. ------------------------------------------------------------------------------------ Code for Field Modify of the Filter public boolean modified() { boolean ret; query q; queryrun qr; querybuilddatasource qbds; querybuildrange qbr; patient pat1; str name; ; ret = super(); name=this.valueStr(); Box::info(name); Medicine_ds.executeQuery(name); medicine_ds.reread(); Medicine_ds.refresh(); return ret; } Code for ExecuteQuery of the DataSource public void executeQuery(str a ="") { boolean ret; query q; queryrun qr; querybuilddatasource qbds; querybuildrange qbr; medicine med1,var; ; // super( ); if(a!="") { Box::info(“medicine called”); q = new query(); qbds = q.adddatasource(TableNum(medicine)); qbr = qbds.addrange(fieldNum(medicine,PID)); qbr.value(a); qr = new queryrun(q); // super(); while(qr.next()) { med1=qr.get(TableNum(Medicine)); while select * from var { if (var.PID!=med1.PID) { medicine_ds.markRecord(var); Box::info(var.PName); medicine_ds.deleteMarked(); } } } //medicine_ds.filter(); // medicine_ds.reread(); // medicine_ds.refresh(); } else { super(); } } ------------------------------------------------------------------------------------ Any help would be useful. Thanks axnovice

Hi, did u tried with the research() method???

Hi,

After updating any database (after writing query), just write one line to get effect on Grid.

abcTable_ds.research();

hi,

1- when you call excuteQuery(), it refreshs and researchs and…etc. if did not work, be sure you did not comment the super of executeQuery().

2- if did not call executeQuery() and there is a modification in data in the table(not in dataSource), you should use abcTable_ds.research()

3- if there is a modification in the data source, abcTable_ds.refresh() will work.

regards.

Best and the shortest solution for the above problem . .

Use the following code " qbds.clearRanges() "

above

qbr = qbds.addrange(fieldNum(medicine,PID));