Calculate field doesn't work

Hi,
I found “Calculate field” doesn’t work if using “FillWithDASql”. I created calculate field in DA and using “OnCalcFiles” events. It works fine if using normal “TDAMemDataTable.Active := true”. Please advise the solution. “FillWithDASql” that look like lost the calculate fields information.

Logged as bugs://D19309.

bugs://D19309 was closed as fixed.

Hi,

  • update uDADataAdapter.pas as
procedure TDABaseDataAdapter.FillWithDASql(aTables: array of TDADataTable;
  aSQLs: array of string; aParameters: array of DataParameterArray);
..
    lRequests[i].IncludeSchema := aTables[i].FieldCount = 0; // <<< changed
  • close Delphi IDE
  • launch C:\Program Files (x86)\RemObjects Software\Build\install_DA.cmd with admin rights

Hi,
Thanks. I tested it works.

Hi,
I found the other problem if using this change. If I create more fields in DB tables without using “Retrieve DataTable Schema”, then it will have an error.

But it doesn’t matter before. I need not to use “Retrieve DataTable Schema” to refresh TDAMemDataTable when I create more table fields.

Hi

Retrieve DataTables Schema is compatible with FillWithDASql only in one case - you are using sql like SELECT * FROM table WHERE ....

it was a reason why we always override schema for FillWithDASql calls …

Hi,
Noted with thanks. It doesn’t matter before I add your advises statement.

That’s mean I need to remove all fields after using “Retrieve DataTables Schema” and create the columns for Devexpress’s cxGrid. If LogicalName is “StoredProcedure”, I should retrieve the parameters and then remove all fields. Right?

Hi,

not yet. You just should add all fields that are used in FillWithDASql with correct types.

another workaround - remove all fields before FillWithDASql if you don’t like define those fields manually

Note: Fields in schema have DisplayLabel property so it can be usable in your cxGrid.

Hi,
Noted with thanks. For cxGrid, I need to add all fields to DAMemDataTable first. Otherwise, I need to create the columns in cxGrid manually.