Page 1 of 1

How send array and varchar in the same object

Posted: 21 Apr 2017, 09:55
by TwineApps
Hi,

How can I send an array from the server and follow a varchar in the same object?

Code: Select all

try{

         ISFSArray arr =   dbmanager.executeQuery(sql,
                        new Object[] {});
         
         if (arr.size() > 0)
         {
             
            SFSObject result = new SFSObject();
            result.putSFSArray("success", arr);
            send("returnchat", result, user);
             
             
            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = new Date();
            dateFormat.format(date);
            SFSObject result2 = new SFSObject();
            result2.putUtfString("success", dateFormat.format(date));
            send("returnchat", result2, user);
             
         }
   }catch (SQLException e) {
     
      ISFSObject error = new SFSObject();
      error.putUtfString("error", "MySQL update error");
      send("returnchat" , error, user);
      e.printStackTrace();
      trace(e.toString());
   }


Yours sincerely

Re: How send array and varchar in the same object

Posted: 21 Apr 2017, 10:10
by Lapo
You have already asked this in a private message.
Just put the two objects (array and string) into the same SFSObject and send it.

Re: How send array and varchar in the same object

Posted: 21 Apr 2017, 10:24
by TwineApps
How can this be done? Can you give me an example?

Greetings

Re: How send array and varchar in the same object

Posted: 21 Apr 2017, 12:19
by TwineApps
Can someone help me?

Re: How send array and varchar in the same object

Posted: 21 Apr 2017, 12:28
by TwineApps
I did this code, but the client just comes the date:

Code: Select all

SFSObject result = new SFSObject();
result.putSFSArray("success", arr);
result.putLong("success", data);
send("returnchat", resukt, user);

Re: How send array and varchar in the same object

Posted: 21 Apr 2017, 13:39
by Lapo
You're using the same key for two different parameters...

Re: How send array and varchar in the same object

Posted: 21 Apr 2017, 13:53
by TwineApps
Lapo solved my mystery, thank you very much