RTC Forums

Subscription => Support => Topic started by: classic12 on November 18, 2011, 02:08:58 PM



Title: Passing more than one parameter.
Post by: classic12 on November 18, 2011, 02:08:58 PM
I have my app cooking nicely and working around all the 'bugs/anomalies/interface glitches'. The component seems rock solid on the iphone on wifi or 3g/ gprs.

On the client I have :

procedure TForm2.Button3Click(Sender: TObject);

  begin
  with UticketEntry.FormTicketEntry.RtcClientModule1 do
    begin
    ClearingEdit1.SelectAll;

    Prepare('hello');
    Param.asString['name']:=ClearingEdit1.Text;
    Call(UticketEntry.FormTicketEntry.RtcResult1);
    end;
  end;

on the server I use:

      with Sender as TRtcDataServer do

      query_text := Param.asString['name'];
      temp := 'SELECT * FROM tickets2 Inner Join ticket_images2 ON tickets2.Ticket_No = ticket_images2.Ticket_No WHERE tickets2.PCN = '+query_text+'';

How do I send a second parameter ie 'name' & 'type' where type would determine which mysql statement to run.

Cheers


SteveW
 


Title: Re: Passing more than one parameter.
Post by: D.Tkalcec (RTC) on November 18, 2011, 05:30:02 PM
For example ...

procedure TForm2.Button3Click(Sender: TObject);

  begin
  with UticketEntry.FormTicketEntry.RtcClientModule1 do
    begin
    ClearingEdit1.SelectAll;

    Prepare('hello');
    Param.asString['name']:=ClearingEdit1.Text;
    Param.asInteger['type']:=1; // <-- HERE, sending a new parameter called 'type'
    Call(UticketEntry.FormTicketEntry.RtcResult1);
    end;
  end;

on the server:

      query_text := Param.asString['name'];
      query_type := Param.asInteger['type']; // <-- HERE, reading a parameter called 'type'
      case type of ...
      ...
      temp := 'SELECT * FROM tickets2 Inner Join ticket_images2 ON tickets2.Ticket_No = ticket_images2.Ticket_No WHERE tickets2.PCN = '+query_text+'';

You can send any number of parameters you want this way from Clients to the Server.

You can also wrap parameters inside records, arrays or datasets, which is what you would need if you wanted to return more than one value from a remote function on the Server back to a Client. For more information about sending and receiving parameters when using RTC remote functions, please read THIS FAQ TOPIC (http://realthinclient.com/sdkarchive/index2ccb.html).

PS. What did you mean with "bugs/anomalies/interface glitches"? Are you refering to the RTC SDK or some other components you are using? If you bump into any problems with the RTC SDK, please let me know so I can fix them.

Best Regards,
Danijel Tkalcec


Title: Re: Passing more than one parameter.
Post by: classic12 on November 20, 2011, 04:42:44 PM
The glitches are the delphi xe2 stuff that does not work as expected on the iphone.

swipes, keyboeard popups , etc etc