Briefcase update in background thread

Having some master tables with very few changes. Already change to briefcase in FMX app because the standard call have poor performance (i blame delphi compiler).

My idea is get some mechanism fired on the server yo inform client app briefcase need to be updated. Theres something? Some idea?

1 Like

Hi,

you can introduce a new event that will inform clients that specific table was changed.

Thanks Evgeny. Where is the best place to raise this event on the server?

if use a beginfill to fill briefcase, which is the best way you think to prevent accessing the table until is in update mode.

Best regards.

Hi,

I think, BP.OnAfterProcessDelta .

Note: you don’t need to create personal BP for each table - you can just assign event to autogenerated BP in DataService.OnBusinessProcessorAutoCreated event like:

procedure TDataService.DataAbstractServiceBusinessProcessorAutoCreated(
  aSender: TRORemoteDataModule; BusinessProcessor: TDABusinessProcessor);
begin
  BusinessProcessor.OnAfterProcessDelta := MyHandler;
end;

I think, you want to prevent user access to table?
it depends on controls what you are using.
some ideas:

  • table.DisableControls/EnableControls.
  • empty/assign TDADataSource.DataTable.
  • set control.Enabled to False/True

I have a 65K records table on android fmx and it takes a lot to fill. There any way to do a sql over a briefcase table to filter only needed records?

Hi,

You could have LastUpdated field that was filled automatically by trigger.
later you could create the DynamicWhere expression and use this RDA method in append mode:

procedure Fill(aTables: array of TDADataTable; aWhereClauses : array of TDAWhereExpression; aSaveCursor: boolean=false; aIncludeSchema: boolean=false; aAppendMode:Boolean = False); overload;

Theres any way to update only changes in a briefcase?

The first load time is very expensive. if we can add only changes can work.

Hi,

No, you can store only full table to briefcase.
if you are using a new format (set aLegacyBriefcaseFormat parameter to false), it also can store delta content to briefcase and later send them to server or cancel.

constructor TDABaseBriefcase.Create(const aFileName: string; const aPreloadData: Boolean; const aOwnTables: Boolean; aLegacyBriefcaseFormat: Boolean = True);