Trigger a non stored calculation based on a schedular job

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Trigger a non stored calculation based on a schedular job

Postby edwin.boon » Tue Oct 11, 2016 8:57 am

Good morning all,

We seem to have a little challenge with triggering a none stored calculation based on a scheduler job. The list view that we use has a calculation as data provider that returns some html for us.
The scheduler job goes off every minute so we can keep track of the progress and we want to show that with a progress bar in our application.
There for we need to trigger this calculation every minute so that we can fill the progress bar.
However we tried to use the databaseManger.recalculate(record) but since we are not using a stored calculation this isn’t working for us.

Is there any other way on how we can do this?

Thanks in advance
Edwin
edwin.boon
 
Posts: 19
Joined: Fri Jul 29, 2016 11:40 am

Re: Trigger a non stored calculation based on a schedular jo

Postby vschuurhof » Tue Oct 11, 2016 10:23 am

Hi Edwin,

What I don't fully understand is why you are using a job to execute such a process. I assume you are executing this inside the regular client? Or are you doing this inside a Headless Client?

If I assume the former option then there are other options to show progress of a long-running process inside a Web Client. If I remember correctly, you guys have some code inside your project to periodically update the UI during such a process and the method is called "updateUI". It is using the WebClientUtils plugin to make this happen, as normally the UI is refreshed as soon as the process has finished.

Please take a look at your code base to see where this has been implemented, as I am 100% it's already there. However, if you are using a Headless Client then we need to look at a different solution.
Vincent Schuurhof
Servoy
vschuurhof
 
Posts: 69
Joined: Tue Dec 14, 2010 12:00 pm

Re: Trigger a non stored calculation based on a schedular jo

Postby edwin.boon » Tue Oct 11, 2016 10:59 am

Hi Vincent,

Its some code Sanneke wrote for us in our application and now we are adding it to our mobile app. (I think i was not completly clear about that in my first post) as far as I know the webclientUtils.plugin isn't going to work here since this is NG.

A minor update on the code we use right now. The databaseManager.recalculate(record) seems to work after only the browser seems not to update it. When I do a zoom in the browser I can see it actually see that the progress bar is updating
edwin.boon
 
Posts: 19
Joined: Fri Jul 29, 2016 11:40 am

Re: Trigger a non stored calculation based on a schedular jo

Postby vschuurhof » Thu Oct 13, 2016 3:54 pm

In the NG Client changes in the model are pushed after the process has completed. This behavior is comparable to how to Web Client handles this. However, as soon as you call any client-side method from the API of any Web Component, the model is pushed directly even if that process is still running. This also works when you call a method from any NG Service.

So a way of solving this is to create a NG Service with a dummy method (something like 'updateUI") which does nothing. This is already enough for data providers to be updated in the browser and this could update a progress bar for example. But be careful by not calling it too many times as this can have a big impact on performance. And also be careful of the amount of model changes as all of them are pushed to the browser.
Vincent Schuurhof
Servoy
vschuurhof
 
Posts: 69
Joined: Tue Dec 14, 2010 12:00 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 13 guests