TXDataClient RawInvoke need RequestId AND SuccessProc

Hello Wagner,

it would be easier for me and above all clearer if the "RawInvoke" method from the TXDataClient could ALWAYS get the "RequestId" parameter.

Reason:
I have many different functions and therefore do NOT use the OnLoadEvent, but use my own SuccessProcs.
But some of these SuccessProcs handle different calls. So that I can distinguish these calls, that would be great.

Would that be possible in the next release?

Best regards
Thomas

Actually exactly the "InternalRawInvoke" procedure. :slight_smile:

procedure TXDataWebClient.InternalRawInvoke(const OperationId: string;
  Args: array of JSValue; const Query: string; RequestId: string;
  SuccessProc: TXDataClientLoadProc; ErrorProc: TXDataClientErrorProc; AsyncMode: Boolean = False);

The RequestId parameter is only included when it's needed. There is no need for the RequestId if you use SuccessProc, because you can use an anonymous method and then capture the current RequestId.

Yes, but it's a lot more work.
For a parameter that already exists anyway.

The problem is that the parameter will be redundant for such methods. What is more work, exactly? Can you share your code so maybe I can understand better what you are struggling with?

I made it too complicated at first.
Now I've found another way to do it.
Here's the code. But I haven't been able to test it yet because I'm still having some issues with Web Core.
But I think it should work. And then it's really not that much effort.
(The "AJobNum" is passed on. Hopefully right.)

procedure TdmDok.GetDokumentlist( AOrdnerID: String; AJobNum: Integer; ACallback: TWebModelCallbackEvent);
begin
  XClient.List( 'Ordnerinhalt',
                '$expand=Dokument/DokTyp&$filter=OrdnerId '+AOrdnerID + '&$orderby=Position asc',
                procedure( Response: TXDataClientResponse)
                begin
                  if Response.StatusCode = _http_200_Ok then
                    ACallback( Self, AJobNum, Response);
                end,
                TXDataClientErrorProc( @XClientError));
end;

1 Like

Correct, that's the idea of using callbacks, you can capture the variables (like AJobNum) so there is no need for request id.