After autofiltering and updating on grid, how to get the filtered records back?

Hi!

I have a grid on a form. I use autofilter to select some records. After autofiltering I press a button that checks a control in on the selected lines. For that I use this - well known - code:

// CODE STARTS

SG_WordDictionary dictionary, _dictionary;
;

for(_dictionary = WordDictionary_ds.getFirst(); _dictionary; _dictionary = WordDictionary_ds.getNext())
{
ttsbegin;
select firstonly forupdate dictionary
where dictionary.RecId == _dictionary.RecId;

dictionary.isAsked = NoYes::Yes;
dictionary.update();
ttscommit;
}

// CODE ENDS

After that I use the code:

wordDictionary_ds.executeQuery();

It’s almost good, but executeQuery method of the dataSource removes autofiltering.

Anyway executeQuery makes the changes visible but I would like to see only the previously selected records.

Is there a way to get the autofiltering parameters back? In that case I could make a filtering in X++ as I would have a direct control for filtering. Or is there an easier way to accomplish the desired functionality?

Thx

Hello Gergő,

Try to use _ds.research() instead of _ds.executeQuery()

Hi Evgeny Arlionak,

Yeee, that’s it… [:)]

Thank you very much!