Requesting Associated Entities

Hey,

i've got an Entity TArtikel with a field Lieferant_nr which refers to the Entity TLieferant.
The field Lieferant_nr is not required in TArtikel and sometimes Null.

So when i request TArtikel Entities to populate a Grid with these Fields
f.ex.: TArtikel.Name | TArtikel.Artikelnr | TArtikel.Lieferant_nr.Name
i receive the Error 404 on every Entity where TArtikel.Lieferant_nr is Empty.

Is it possible to suppress this Error somehow?
I'm coming from MSSQL and i'm used to SQL-Views where not associated Fields were left Blank in the Grid.
Is it somehow possible to reconstruct this behaviour?

Kind regards,

You should not be receiving these erros. Do the errors happen at runtime without the application being debugged from Delphi IDE?

Can you please provide the call stack at the moment of the exception? TAureliusDataset should silently ignore any kind of such erros and display the Lieferant_nr.Name field as empty.

Thank you for the project sent in private. This is a behavior of XData client, not the dataset.
We have improved it internally so that it doesn't raise exceptions in those situations. It happens only when loading the proxied associations.
In the meanwhile, you can workaround it by forcing the load of the proxied associations (it's even recommended to do so for performance improvement, since you are displaying such data in a dataset):

  MainXDClient.HttpClient.OnSendingRequest :=
    procedure(Req: THttpRequest)
    begin
      Req.Headers.SetValue('xdata-proxy-load-depth', '1');
    end;

Thank you very much!
Works

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.