this.FFieldMapper is null

I have a grid with a Xdataset.

After exceuting a querystring the grid is updated and showing the records correct BUT when I want to inspect field values or even the recordcount I get an error.


DataModule1.XDDataSet_ExportGebruiker.QueryString :=
Format('$filter=(Login EQ ''%0:s'' AND Paswoord EQ ''%1:s'' )',
The Grid is updated correctly


WLBL_Melding.Caption := intToStr(DataModule1.XDDataSet_ExportGebruiker.RecordCount);
Result = 0 (it shoud be 1)

if DataModule1.XDDataSet_ExportGebruiker.FieldByName('Login').AsString <>
EDT_UserName.Text then
WLBL_Melding.Caption := WLBL_Melding.Caption + ' Fout !!!'
WLBL_Melding.Caption := WLBL_Melding.Caption + ' Goed !!!';

and this error

this.FFieldMapper is null

What is wrong with the code?

Keep in mind that DataModule1.XDDataSet_ExportGebruiker.Load executes asynchronously.
All code that you are trying to execute after the call to Load should be moved to the AfterOpen event of the dataset. That's the explanation why record count is 0, for example, instead of 1.