SAP REST Mobile local storage advice needed on refreshing data

SAP REST Mobile local storage advice needed on refreshing data



I'm creating a mobile app which uses SAP REST services in JSON format. The app shows assignments on a weekly basis and all assignment are retrieved per day for a specific week. User can modify and send it back to the SAP server. 

I have a screen that shows the days of a week. Every day consists of a dropdown list of tasks of that day to be added or modified by the user. Initially data is retrieved of the current week and stored in 2 local entities (weekdays and tasks). Modifications by user are done in the local data. There is no server database within OutSystems created, since we intend to send it back to SAP directly.

In the screen i have in the OnInit event the calls of the REST and storage in the local entities. In the OnReady event i have some string operations to be displayed on the screen. The daily tasks are populated once the user expands a day. For reusability i have given the screen and all underlying functions/procedures an input parameter for the requested week.

When i start the app, the current week and its data is shown correctly. When i press the next or previous week navigator in the GUI, i give the next/previous week as input parameter back to the screen and with the same screen as destination in the action flow.

I have put some display messages in the actions and it gets the correct week as input, but when all underlying actions are processed the screen looks the same; that is still showing the current week after the screen is refreshed.

I can't do any ajax refresh of widgets, which seems like it doesn't do any server calls. 

Maybe my approach was not correct, so i need some advice on this. Should i have created a database in OutSystems next to my local storage first and then be able to do ajax refresh on the screen widgets?

How can i debug a mobile app that calls REST calls actually? I can't view the data until i see it in my app.

Hope some expert can give me advice on this matter. Thanks.

Hi Rookie,

First, it seems you have a misunderstanding about how mobile apps and AJAX work. A mobile app runs client side - all variables, and screens, live on your mobile device. AJAX is a way to refresh partial screen content via a submit to the server. This means that there's never any AJAX on mobile (and it shows, the AJAX Refresh is not available for a mobile app).

That said, the way screen refresh is triggered on a mobile app is by changing the variables that are bound to the screen. So if you have an Expression that says something like "Total foobars" + IntegerToText(TotalFooBars), the moment you change TotalFooBars in a screen action, the expression is updated.

With Blocks, it's slightly more complicated. Blocks (called Web Blocks for web apps, just Blocks for mobile apps) have input parameters. If an input parameter is used inside an expression on the Block, and you change the value of the variable that is input to the Block in a Screen, the input parameter is automatically updated. If you have that input parameter as an Expression, the Expression is therefore updated as well. However, if the Block needs to perform some calculations or fetch data based on the input parameter (which is e.g. handled in the OnInitialize), that calculation or data may need to be refreshed. That's where the Block's On Parameters Changed Event comes into play. You can specify a Screen Action that will be executed when one of the Input Parameters is changed. If you have more than one Input Parameter, and each triggers a different calculation or fetch, you may want to distinguish by checking which one changed (e.g. by copying it to a local variable, comparing, etc.).

In your scenario, you do a page transition to the same page. That's almost never what you want in mobile. With the above, check your screen logic and update it accordingly. Not having your source code at hand I can't give any more specific advice. If you have further questions, please let me know.


Hi Kilian,

Thanks for the clarification.

It seems the call for the next / previous week was not called correctly with the parameters at the right positions and defaults to the current week.