cancel
Showing results for 
Search instead for 
Did you mean: 

How to use multiple services in mdk application?

0 Kudos

Hi

I am using both offline and online services in the application,i have added the two services on application onlaunch event and given the oninitialization action on ondidupdate event, the offline service is working fine but the online service is not working, can any one tell me the reason ? or is this the correct way?

Accepted Solutions (1)

Accepted Solutions (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Each service in your applications needs to be initialized / opened independently. For Offline services that means calling Initialize for the service to specify the defining requests and download the data (first time only). For an online OData service this means calling CreateService and OpenService before attempting to access the service.

Since OnDidUpdate only takes a since action/rule, I would probably call my Initialize action (in both OnDidUpdate and OnLoaded) and in the OnSuccess chain the Create Service and the Open Service with a final message action to indicate the data services are initialized.

Then when targeting controls in the pages you can specify which service/entity set the control is associated to. Remember, be careful when working with the same data using the offline and online services since you can easily end up out of sync.

--Bill

Answers (1)

Answers (1)

0 Kudos

Thanks a lot Master!