RPC HELP TSharedRPCBroker Example
From VistApedia
Jump to navigationJump to search
The following example demonstrates how a TSharedRPCBroker component can be used to connect to the VistA M Server, execute various remote procedures, return the results and finally disconnect from the server. This example assumes that a TSharedRPCBroker component already exists on the form:
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin
try
if not SharedRPCBroker1.Connected then
SharedRPCBRoker1.Connected := True; {connect to the server}
//assign RPC name
SharedRPCBroker1.RemoteProcedure := 'SOME APPLICATION RPC';
SharedRPCBroker1.Call; {make the call}
for i=0 to Pred(SharedRPCBroker1.Results.Count) do
ListBox1.Items.Add(SharedRPCBroker1.Results[i]); {display results}
except
//put error handling code here
end;
end;