select – mark specific dataset in filtered grid – Education Career Blog

i’m just struggling through the following situation –
there’s a datasource added to a grid in axapta 2009, filtered by a querybuildrange.

i want to mark a specific dataset by x++ via

datasource_DS.findrecord( specificRecord )

this works as intended, removing the filter, but not having the filter active!
a workaround to remove the filter and add everything ( filtered! )to a temporary table first is not what i want.

i can’t imagine there’s no way to achieve this task?!
thanks in advance!

edit:

datasources on form:
– ProdRouteJob ( JoinSource: ProdTable, LinkType: InnerJoin )
– ProdTable

only datasets containing a specified ProdStatus should be displayed in the grid.
This is done by the mentioned Range, e.g.:

prodStatusRange =  prodTable_ds.query().dataSourceTable( tablenum( ProdTable )).addRange( fieldnum( ProdTable, ProdStatus ));
prodStatusRange.value( "(( ProdStatus == 0) || ( ProdStatus == 1 ))" );

selecting a specified dataset is done by, e.g.:

ProdRouteJob currentProdRouteJob;
;
currentProdRouteJob = ProdRouteJob::findJobId( "JOB_12345" );
info ( currentProdRouteJob.JobId );
prodRouteJob_DS.findRecord( currentProdRouteJob );

the info-function shows the correct JobId.
if i remove the filter, findRecord() selects the dataset, if not – not.
adding the DS.research( true ); does not change this behaviour.

,

You objective is to redraw the grid and to retain any filtering.

In AX 2009 it is easy:

datasource_DS.research(true);

In AX 4.0 and previous you can research and then refind:

specificRecord = datasource.data();
datasource_DS.research();
datasource_DS.findRecord(specificRecord) 

This can sometimes be slow if there are many records in the grid.

Leave a Comment