Hey,

Sorry for the formatting, change your sample in my mobile. Try something
like this:

Ape.registerCmd('somecommand', false, function(params, infos) {
   var channel = Ape.getChannelByPubid(params.pipe);
   ...
   sql.query("SELECT * FROM table", function(res, errorNo) {

//And than I wnat to work with the res outside the sql, so here:


   if(res[0].someparam == 1){
       //Some bussines logic with sql queries and other stuff
   }
   else{
       //Some other bussines logic with sql queries and other stuff
   }
   ...
   if(channel){
       //And use here in the returning data
       channel.pipe.sendRaw('response',{'sqldata':res[0].somedata});
   }

   });

   return 1;
});

On Sat, May 9, 2015, 11:04 AM Sándor Volenszki <[email protected]>
wrote:

> Dear Pablo!
>
>
>  I don't want to be irksome, but I still don't understand, and I feel, I
> composed my question badly. So I did a snipet to represent my real problem:
>
>
>  Ape.registerCmd('somecommand', false, function(params, infos) {
>
>     var channel = Ape.getChannelByPubid(params.pipe);
>
>     ...
>
>     sql.query("SELECT * FROM table", function(res, errorNo) {
>
>         //Here I get the res, which contains all the mysql returned data
>
>     });
>
>     ...
>
>     //And than I wnat to work with the res outside the sql, so here:
>
>     if(res[0].someparam == 1){
>
>         //Some bussines logic with sql queries and other stuff
>
>     }
>
>     else{
>
>         //Some other bussines logic with sql queries and other stuff
>
>     }
>
>     ...
>
>     if(channel){
>
>         //And use here in the returning data
>
>         channel.pipe.sendRaw('response',{'sqldata':res[0].somedata});
>
>     }
>
>     else{
>
>         return ['109', 'UNKNOWN_PIPE'];
>
>     }
>
>
>      return 1;
>
> });
>
>
>  How can I do this?
>
>
>  Thank you for your attention!
>
>
> 2015. május 8., péntek 15:04:28 UTC+2 időpontban Pablo a következőt írta:
>
>> Hey guys,
>>
>> This a typical scenario in JS, you must call your function in the
>> callback. In the case of APE if you need to get the data back to the user
>> then in your function/callback you must sent a raw to the user pipe, like
>> Mike suggested. The response to the user does not needs to originate from
>> the original request.
>>
>> On Fri, May 8, 2015, 3:30 AM Sándor Volenszki <[email protected]> wrote:
>>
> Hi Utan!
>>>
>>> Do you have any solution for this problem? I am also stucked here.
>>>
>>> Thanks in advice!
>>>
>>> 2012. január 24., kedd 21:49:29 UTC+1 időpontban UTAN a következőt írta:
>>>
>>>>
>>>> Did you solved this issue?
>>>>
>>>> Returning the callback var inside anonymous function and making
>>>> available to the parent function?
>>>> I am stuck on that..
>>>>
>>>> regards
>>>>
>>>> On Jan 16, 12:11 pm, Micael Ribeiros <[email protected]> wrote:
>>>> > Yes, but how do I process the data if I can only return it inside the
>>>> > loop/callback, I cant even pass data to the callback, or can I?
>>>
>>>  --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "APE Project" group.
>>>
>> To post to this group, send email to [email protected]
>>
>>
>>> To unsubscribe from this group, send email to
>>>
>> [email protected]
>>
>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/ape-project?hl=en
>>> ---
>>> APE Project (Ajax Push Engine)
>>> Official website : http://www.ape-project.org/
>>> Git Hub : http://github.com/APE-Project/
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "APE Project" group.
>>>
>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>
>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "APE Project" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/ape-project?hl=en
> ---
> APE Project (Ajax Push Engine)
> Official website : http://www.ape-project.org/
> Git Hub : http://github.com/APE-Project/
>
> ---
> You received this message because you are subscribed to the Google Groups
> "APE Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

--- 
You received this message because you are subscribed to the Google Groups "APE 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to