SendAsyncWebRequest vs SendWebRequest
Paul Timms
4-4-25
Operating system: macOS
SendWebRequest3 is a boolean function, so if this returns true and the reply header has an accepted status, you can assume that the data was sent successfully and perform some actions on the record that was sent, for example to update a "Sent" status.

SendAsyncWebRequest is a procedure. It receives the reply and reply header into a different "callback" procedure which is entirely disconnected from the previous chain. So, although you can confirm in this callback procedure that the data was accepted, how can you then return this information back to the record in order to update the "Sent" status, if the reply does not contain any useful information?
This answer was correct
Created byDavid Delač08:14 17 Apr 2025
Hello Paul!

You can make use of transactions variables to store record number once you've received expected reply.

Function / Procedure that is calling SendAsyncWebRequest should have transaction variable that you will populate with value that you can use to find your record. Once you declare transaction variable in your reply function, it will automatically contain the value previously set and you can use it.

eg.

transaction string 255 gCUCode;
gCUCode = "TEST";
SendAsyncWebRequest(...,"CallbackFunc",30);


global
procedure CallbackFunc(...)
begin
transaction string 255 gCUCode;

//gCUCode would already be "TEST" here as the value of it is stored in RAM globally.

return;
end;

Let me know if this was clear enough or should I give better example.

Best regards,
David D.
This answer was correct
David Delač
4-17-25
Hello Paul!

You can make use of transactions variables to store record number once you've received expected reply.

Function / Procedure that is calling SendAsyncWebRequest should have transaction variable that you will populate with value that you can use to find your record. Once you declare transaction variable in your reply function, it will automatically contain the value previously set and you can use it.

eg.

transaction string 255 gCUCode;
gCUCode = "TEST";
SendAsyncWebRequest(...,"CallbackFunc",30);


global
procedure CallbackFunc(...)
begin
transaction string 255 gCUCode;

//gCUCode would already be "TEST" here as the value of it is stored in RAM globally.

return;
end;

Let me know if this was clear enough or should I give better example.

Best regards,
David D.
Paul Timms
4-23-25
Thanks David! I'll give that a go and confirm if that works.

Paul
View all Questions
Back to the list
Latest Posts
Gastón Salomone
Hi David, I´ve done lost of test, including rebuild database, add more level of verbosity, click on every check on Log Messages on database and still, once that function is called server crash. ...
15:59 9 May 2025
Paul Timms
From what I've read, using these will store the updated records in memory and then write them to the database in bulk, instead of each record writing to the database in turn. So perhaps there&apo...
17:53 29 Apr 2025