HI 

Inside mobile application is it possible to abort/cancel the server action ?

And how can I put priority of server actions?

Regards,

Anahit

Anahit Pahlevanyan wrote:

HI 

Inside mobile application is it possible to abort/cancel the server action ?

And how can I put priority of server actions?

Regards,

Anahit

Hi,

Can you specify the one which you wish to abort?

As of there are many Actions that are called as per default flow & many of the Actions are only called when we invoke them manually.

-Assif


Hello Anahit,

Once you call a Server Action, you can't abort it from "outside" the Server Action.
Once the request was made, the Server will execute it until it finishes, generates an exception or times out.

At least I don't know any way to do what you are asking.

Could you explain better what you are trying to do?

Cheers.

Totally Agree with Eduardo,

Once the Server Action is triggered we cannot abort it, But we can control the calling of respective via some conditions if we want for a specific one.

And for the priority.. there's no any such feature I guess available[Do correct me If I am wrong]. Any of the Server Action gets called only when Triggered via calling it. 



HI thanks everyone for reply


My problem is inside the program I do search for people. Each people has their own image. To get that image I have to do another rest api call for each received people to retrieve the image url.


if user at that time wants to do another search user has to wait until all images requests are finished. 


In my case if user wants to do another search I want to stop all image retrieval process.


Any help will be appreciated. 


Regards,

Anahit 

Is the REST API to fetch the image URL slow? Ideally, the search results returned to your mobile app should already contain the image URLs. It may be better to do one larger request (search + retrieve all necessary URLs) than many small ones.

João Pedro Abreu wrote:


Hi thanks for the reply


this will not help as to retrieve 100 users photo in one request will take 1 minute to finish the one request. 

Is the REST API to fetch the image URL slow? Ideally, the search results returned to your mobile app should already contain the image URLs. It may be better to do one larger request (search + retrieve all necessary URLs) than many small ones.



Hi, just separate between getting user data and user image.

Once the user is searching, just grab the data, and put another button to retrieve its image.

Anahit Pahlevanyan wrote:

HI thanks everyone for reply


My problem is inside the program I do search for people. Each people has their own image. To get that image I have to do another rest api call for each received people to retrieve the image url.


if user at that time wants to do another search user has to wait until all images requests are finished. 


In my case if user wants to do another search I want to stop all image retrieval process.


Any help will be appreciated. 


Regards,

Anahit 

"if user at that time wants to do another search user has to wait until all images requests are finished."

You can use DataActions which are Asynchronous & Multiple DataActions can be called at a time parallelly. Thus whichever REST API you want to call, call it under DataAction. This way user API call will be fast as compared to Synchronous one which executes one-by-one.

Hope it helps.

Assif

assif_tiger wrote:Hi Assif I change it to DataActions. Yes it does asynchronous requests, but the problem is, even when I close the widget the DataActions are still processing. I don't need DataActions to keep implementing when the screen is closed. Is there any way to cancel or abort DataActions before closing the screen ?

Anahit Pahlevanyan wrote:

HI thanks everyone for reply


My problem is inside the program I do search for people. Each people has their own image. To get that image I have to do another rest api call for each received people to retrieve the image url.


if user at that time wants to do another search user has to wait until all images requests are finished. 


In my case if user wants to do another search I want to stop all image retrieval process.


Any help will be appreciated. 


Regards,

Anahit 

"if user at that time wants to do another search user has to wait until all images requests are finished."

You can use DataActions which are Asynchronous & Multiple DataActions can be called at a time parallelly. Thus whichever REST API you want to call, call it under DataAction. This way user API call will be fast as compared to Synchronous one which executes one-by-one.

Hope it helps.

Assif



Anahit Pahlevanyan wrote: Anyway changing to DataAction will not solve my problem.

assif_tiger wrote:Hi Assif I change it to DataActions. Yes it does asynchronous requests, but the problem is, even when I close the widget the DataActions are still processing. I don't need DataActions to keep implementing when the screen is closed. Is there any way to cancel or abort DataActions before closing the screen ?

Anahit Pahlevanyan wrote:

HI thanks everyone for reply


My problem is inside the program I do search for people. Each people has their own image. To get that image I have to do another rest api call for each received people to retrieve the image url.


if user at that time wants to do another search user has to wait until all images requests are finished. 


In my case if user wants to do another search I want to stop all image retrieval process.


Any help will be appreciated. 


Regards,

Anahit 

"if user at that time wants to do another search user has to wait until all images requests are finished."

You can use DataActions which are Asynchronous & Multiple DataActions can be called at a time parallelly. Thus whichever REST API you want to call, call it under DataAction. This way user API call will be fast as compared to Synchronous one which executes one-by-one.

Hope it helps.

Assif





# use site properties that can be changed from service center, then by making it false/wrong, the action will be stopped, include a wrong REST base URL (you can change and make it error).

Hi The Cuan, 

Please, don't. This is a terribly horrible idea... 

Hello Anahit. 

Once a server action is called, a request is send to the server. 

There is no way to abort the request after it was sent, and any workaround you can came up will just make things worse. 

So, don't. 

Just live with the fact that there will be a request that will be "lost" or change your interface to minimize the problem, like doing some caching of the images in the device, for example, allowing for avoiding requesting the images each time. 

Cheera

You could do something with stages?
Keep some temp tables with the webservice, when the first part of the action is complete, you can return a transactionId or something, which can be used to initiate stage 2 (using another call or using a state input).

If the 2nd call is never performed you can clear the temp table using a timer for instance.

Is it good idea to do image request with Javascript Ajax? so I can later on cancel request using javascript ?

Anahit Pahlevanyan wrote:

Is it good idea to do image request with Javascript Ajax? so I can later on cancel request using javascript ?

Nope. For at least two reasons.

1. You will be messing with JavaScript. Avoid that whenever possible.

2. The abort will likely happen on the device only, not the server (that will continue its execution). So, if your problem is resources consumed by the server, it will not stop it because of the abort.

I still recommend you to rethink your design.

Cheers.


The mobile Image widget performs a lazy load of pictures by default, meaning it only retrieves images when they are visible to the user. This is a pattern made specifically to solve this issue, except you can't apply it because you need to do additional calls to an external API to obtain the image URLs. I don't know if you have any control of the API that you are using to search, but if it returned the image URL it would be much better.

Assuming you don't have any control of the API, like Eduardo said, you should probably rethink your user interface. Don't display images on the list, and allow viewing list item details on clock, for example.