Hi

I am looking at my options to optimise the home screen of an application and I would like to know if BPT is a possible solution for my use case.

The home screen has links to 20 screens ('milestones'). Beside each Milestone is shown total of the number of items that are in that screen and these totals are calculated via a large SQL query in the preparation. This makes the screen a bit slow. 

I am wondering if I can split this SQL to individual queries and run them asynchronously. I understand the only way this is possible in Web App is via BPT..

Does it make sense to create a BPT process just for calculating these totals for a home screen? We have not implemented BPT in our application anywhere else.


e.g.

- Preparation creates a record containing some required session parameters 

- Creation of new record in this entity starts a BPT process

- asynchronous activities to calculate totals for each 'Milestone' and save to db

- somehow refresh screen to display the Milestone totals from db (how can I notify the screen??)


So is this possible, or is there a better way?


Another possible approach would be to use the Web Event JavaScript Extensibility component from the Forge.

Using that, you could create a small Web Block to add to your home screen, which would be responsible for calling one or more screen actions to perform the queries. The Web Event JavaScript Extensibility component would allow you to use JavaScript on the home screen (perhaps using jQuery's .ready event) to call an event on the web block, triggering the call to the screen action(s). Then you can just use AJAX refresh of the UI components with the updated values.


G. Andrew Duthie wrote:

Another possible approach would be to use the Web Event JavaScript Extensibility component from the Forge.

Using that, you could create a small Web Block to add to your home screen, which would be responsible for calling one or more screen actions to perform the queries. The Web Event JavaScript Extensibility component would allow you to use JavaScript on the home screen (perhaps using jQuery's .ready event) to call an event on the web block, triggering the call to the screen action(s). Then you can just use AJAX refresh of the UI components with the updated values.


Thanks for your reply. 

Although this could be a suitable solution, unfortunately we are working with version 10 and my company are not upgrading to 11 until a bit later in the year. Ideally i would like a solution that will work with 10, perhaps temporarily until we upgrade.


BPT process run on a different thread than the web session. It would not have access to any of the session variables. As far as how to notifiy the user, you have a number of options:

  • send an email to the person that started the process that the calculations are complete
  • udpate a status flag on some table. That would drive behavior on a page

I am sure that there are other ways, but those are the 1st two that come to mind.

Stacey Levine wrote:

BPT process run on a different thread than the web session. It would not have access to any of the session variables. As far as how to notifiy the user, you have a number of options:

  • send an email to the person that started the process that the calculations are complete
  • udpate a status flag on some table. That would drive behavior on a page

I am sure that there are other ways, but those are the 1st two that come to mind.

Thanks.

Sorry i don't understand the use of the email option, since the totals are part of the home screen and they just need to be displayed there.

The other option is the kind of solution i am thinking of, i.e. updating an entity that the screen has access to. However the issue is how will the screen know when to refresh the data (i.e. when it has changed)?


The email was letting the user that the calculations were complete. In either case, you would need to store the results somewhere. You could email the results to the user, or just store the results that its complete and the page then would view the values

Yes it is perfectly possible to do this with BPT if the SQL finishes within the max time out of bpt which is 5 minutes. If SQL take longer than 5 minute you need to use timers.

You can do a auto refresh of your screen using JavaScript interval to refresh the calculated totals on your screen. Alternatively you could use a notification system like pusher to have your screen updated when a total is calculated.

Also the web event extensibility component in the forge does also work I think on OS10

Stacey Levine wrote:

The email was letting the user that the calculations were complete. In either case, you would need to store the results somewhere. You could email the results to the user, or just store the results that its complete and the page then would view the values

Storing the results is not really the issue. I'm trying to find a solution for refreshing the screen once the results have been calculated and stored. I haven't heard any solution for this yet...


The solution would be to have a javacsript timer that activates an event on the page to check for data or a flag. once it finds it, then it does the appropriate ui refreshes

Daniël Kuhlmann wrote:

Yes it is perfectly possible to do this with BPT if the SQL finishes within the max time out of bpt which is 5 minutes. If SQL take longer than 5 minute you need to use timers.

You can do a auto refresh of your screen using JavaScript interval to refresh the calculated totals on your screen. Alternatively you could use a notification system like pusher to have your screen updated when a total is calculated.

Also the web event extensibility component in the forge does also work I think on OS10

Thanks - thats good to hear. Yes we are talking seconds, not minutes, so it wont get near to the BPT max time out.

I will look into the two suggestions you have provided for notifying the screen.

Events are new to OS11 so I wouldnt have thought the component would work with OS10.


Hi Craig,

I am sorry the component is indeed for OS11 but should be to difficult to change it to work for OS10,

You only have to replace the event and calling the event handler on the one weblock in the module to use a notify and get notify message.

Regards,

Daniel

Just a gentle reminder, if you mention in your initial post which version of the platform you are running, it's easier for folks to ensure their answers are relevant for your version.

Solution

Craig Duggan wrote:

Daniël Kuhlmann wrote:

Yes it is perfectly possible to do this with BPT if the SQL finishes within the max time out of bpt which is 5 minutes. If SQL take longer than 5 minute you need to use timers.

You can do a auto refresh of your screen using JavaScript interval to refresh the calculated totals on your screen. Alternatively you could use a notification system like pusher to have your screen updated when a total is calculated.

Also the web event extensibility component in the forge does also work I think on OS10

Thanks - thats good to hear. Yes we are talking seconds, not minutes, so it wont get near to the BPT max time out.

I will look into the two suggestions you have provided for notifying the screen.

Events are new to OS11 so I wouldnt have thought the component would work with OS10.


If you are just talking seconds, you could always create a screen action to perform the calculations and AJAX Refresh the appropriate components.  Then, add JavaScript when your screen loads to immediately fire the AJAX call.  It's not ideal to call AJAX the moment your screen loads, but for this use case it seems like the most straight forward way.

Solution

Craig St. Jean wrote:

Craig Duggan wrote:

Daniël Kuhlmann wrote:

Yes it is perfectly possible to do this with BPT if the SQL finishes within the max time out of bpt which is 5 minutes. If SQL take longer than 5 minute you need to use timers.

You can do a auto refresh of your screen using JavaScript interval to refresh the calculated totals on your screen. Alternatively you could use a notification system like pusher to have your screen updated when a total is calculated.

Also the web event extensibility component in the forge does also work I think on OS10

Thanks - thats good to hear. Yes we are talking seconds, not minutes, so it wont get near to the BPT max time out.

I will look into the two suggestions you have provided for notifying the screen.

Events are new to OS11 so I wouldnt have thought the component would work with OS10.


If you are just talking seconds, you could always create a screen action to perform the calculations and AJAX Refresh the appropriate components.  Then, add JavaScript when your screen loads to immediately fire the AJAX call.  It's not ideal to call AJAX the moment your screen loads, but for this use case it seems like the most straight forward way.

Thanks. To clarify, are you suggesting to have the action called by JavaScript rather than have it in the preparation? How would you trigger it?


Craig Duggan wrote:

Thanks. To clarify, are you suggesting to have the action called by JavaScript rather than have it in the preparation? How would you trigger it?

Yes, that is what I am suggesting.  You have a couple of options, depending on what seems more preferable to you:

  1. With a hidden button
    1. Add a button to your page and set it to not display
    2. Make the button perform an AJAX Submit, where you perform your calculations and AJAX Refresh the page
    3. Trigger it with a Widget_Click (RichWidgets) in your Preparation (or with JavaScript via OsAjax)
  2. Using FakeNotifyWidget (https://www.outsystems.com/forums/discussion/20631/calling-a-screen-action-on-extended-properties-onblur-onfocus-etc/#Post136252)

Craig St. Jean wrote:

Craig Duggan wrote:

Thanks. To clarify, are you suggesting to have the action called by JavaScript rather than have it in the preparation? How would you trigger it?

Yes, that is what I am suggesting.  You have a couple of options, depending on what seems more preferable to you:

  1. With a hidden button
    1. Add a button to your page and set it to not display
    2. Make the button perform an AJAX Submit, where you perform your calculations and AJAX Refresh the page
    3. Trigger it with a Widget_Click (RichWidgets) in your Preparation (or with JavaScript via OsAjax)
  2. Using FakeNotifyWidget (https://www.outsystems.com/forums/discussion/20631/calling-a-screen-action-on-extended-properties-onblur-onfocus-etc/#Post136252)

Thanks for clarifying. Following your previous post I had started working on it with the hidden button method.

I have put the following JavaScript at web block level, as this is where the data is being displayed;


window.onload = function() {
    $('[data-btnhidden]').click();
};


The hidden button runs a screen action that does the logic then Ajax refreshes the block. I have the code working as the button is being clicked and page refreshes, so now I need put the logic in and see if it improves the user experience overall. If not, I may need to revisit the BPT idea.

Thanks all!