RTC Forums
November 24, 2024, 09:59:48 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Passing more than one parameter.  (Read 4625 times)
classic12
Guest
« 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
 
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 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.

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
Logged
classic12
Guest
« Reply #2 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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.024 seconds with 17 queries.