Anthony Hyams
Posts: 0
Joined: Tue Apr 01, 2014 10:54 am

Database services - changing instances

I have a query service to a collection in my database that gets events on a particular date. If I create an instance of this on a page it adds the service to the page and I give it a new name. I can then edit mappings etc. All this seems fine

If I now edit the underlying service does this change all instances of the service? So for example if I wanted to get saturdays events for one page and sundays events for another page. Do I need to create two copies of the query service. Or do I create one instance with the where = saturday and then edit the query service so the where = sunday and create a new instance on the required page?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Database services - changing instances

Hello,

[quote:]
If I now edit the underlying service does this change all instances of the service?
[/quote]
It change only Datasource on the screen.
http://docs.appery.io/documentation/r...

[quote:]
Do I need to create two copies of the query service
[/quote]
You don't need to create two copies. You just need one query service which you can use in the different screens with different parameters.

Anthony Hyams
Posts: 0
Joined: Tue Apr 01, 2014 10:54 am

Database services - changing instances

I've read the service documentation and don't have a problem adding a service. However that documentation is very ambiguous when it comes to the role of a service and an instance of the service.

Your answer seems at odds with the interface. When I create an instance and name it there is a link to the service. If I click it it allows me to edit the service. So I can change an existing where parameter. However if I go to a page using an instance of the service - the same link exists - if I click it then it shows the same changed query. Suggesting both instances are using the same underlying service.

I have got round the confusion by duplicating services based on what query I want to run, so if I have a query service for a collection I create a query service for each different requests (this is a lot of services) then add it to the page. I suspect this is not efficient or how you envisaged it being used. However it is very unclear how services and instances of those service relate to each other

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Database services - changing instances

Hello Anthony,

Each instance of the service is not dependent.
You should use one service but different whrere parameter. Add mapping localStorage variable - where.
Where you need run service with parametr "saturday" or "sunday", set it to the localStorage variable and run service after

Return to “Issues”