Page 1 of 2

how to write success event of a database service using javascript

Posted: Sun Mar 16, 2014 7:16 pm
by Asif

I have a call a create service on the success of a query service, but I have to achieve this scenario using java script.

pls help!!


how to write success event of a database service using javascript

Posted: Sun Mar 16, 2014 8:17 pm
by Illya Stepanov

Hi -

Can you show the code you have tried?

For events handling please check this section:
:: http://docs.appery.io/documentation/r...


how to write success event of a database service using javascript

Posted: Sun Mar 16, 2014 8:55 pm
by Asif

I will tell you the scenario :

I am mapping response of a service "$" to a java script.
In this java script i m calling a database inquiry service. And on the success of the inquiry service i have to call another create service.
Parameters of the create service will come from the $ which i have marked to JS.
So how can i write a success event of inquiry service in this JS where i can call the create service.


how to write success event of a database service using javascript

Posted: Mon Mar 17, 2014 3:34 am
by Alena Prykhodko

Hi Asif.

You need to "Add js" to your js in the mapping. http://docs.appery.io/documentation/r...

By means of this you can:

  1. Access your "$" through the "value" variable.
    pre

    var user_name = value.userName;/pre

  2. Invoke the service:

    preserviceName.execute({data: {"parameter1": "val", "parameter2": val} });/pre


how to write success event of a database service using javascript

Posted: Mon Mar 17, 2014 2:23 pm
by Asif

Hi Alena,
These 2 steps i m already doing, what i want is that after invoking the service i want to write success event of this service in the same js.

like step 1
code
serviceName.execute({data: {"parameter1": "val", "parameter2": val} });
/code
step 2
code
serviceName.onSuccess();
//my code
/code

something like this


how to write success event of a database service using javascript

Posted: Mon Mar 17, 2014 11:00 pm
by Igor

Hi,

Using service event on the service data tab is more preferable

http://docs.appery.io/documentation/r...

or you could use code below:
pre
code
serviceName.execute({data: {"parameter1": "val", "parameter2": val},
success: function(){
//some code
}});
/code
/pre


how to write success event of a database service using javascript

Posted: Tue Mar 18, 2014 7:35 pm
by Asif

Hi Igor.
Thanks a lot, this is exactly what i want.


how to write success event of a database service using javascript

Posted: Tue Jul 28, 2015 5:42 pm
by Enfiled Riders

How do I write an update service in java?..this update service has a where clause and a $set clause.


how to write success event of a database service using javascript

Posted: Tue Jul 28, 2015 5:52 pm
by Illya Stepanov

Hi -

Appery.io don't work with Java, every database service is a REST service you will need just to invoke it this way: https://devcenter.appery.io/documenta...

Database API is explained here: https://devcenter.appery.io/documenta...


how to write success event of a database service using javascript

Posted: Tue Jul 28, 2015 5:53 pm
by Enfiled Riders

I meant javascript