45
Views
5
Comments
Solved
Client Action Behavior - Reactive Web
Question

Hi Team

Is there a reason behind not being able to use client actions that are not functions inside of client actions that are functions also not being able to add server actions inside client action in reactive web applications. I have declared global client action for the module. 

Here is my problem, it would be nice to have an alternative solution:

In order to assign a static list without a static entity I wanted to assign the drop-down in reactive web applications using something like string-split("Yes,No",","). Unable to do so as the server functions are not available for the widgets I decided to create a client action function that would in turn be a wrapper around the server action string-split. This did not work and was somewhat what I expected, but, it would be nice to have some clarity as to why we are not allowed to use server actions inside global client actions even though we can do the same in the event handler for example client actions in screens that handle button clicks are allowed to have server actions. 

Further more, I wanted to write my own client string split and to do that I wanted to use client list clear for my use case and it did not allow me to use client actions that are not functions inside of client actions that are functions, which does not make a lot of sense to me.

It would be nice to have some clarity over these things, and if there is an alternative approach to what I am trying to do, I could call a data action and use the string_split there but, this would have to be created in every screen where I would wish to use such a static list.

Thanks in Advance!

Ashish

mvp_badge
MVP
Rank: #89
Solution

Hi Ashish,

Adding to Dorine's comment, I just want to point you to an OutSystems documentation related to this concept.

https://success.outsystems.com/Documentation/11/Reference/Errors_and_Warnings/Errors/Invalid_Client_Function

- Global Client Action set as Function action flow can't contain the below listed node/element 

1) Normal Client/Server Action

2) Server action set as a Function

3) Aggregate node referring to Server/Client Entity as Source

Note: Client Action set as a Function will allow you to include another defined Client Action which is also set as a Function within its action flow


Q2. Regarding populating the Dropdown widget options without referring the static entity, instead using the Output List of a Client action set as a Function, I found a work around (You just have to pass the string in JSON format)

Check this sample app... 

Please find the attachment


Hope this helps you!


Regards,

Benjith Sam

ReactiveAppLab.oml

Rank: #135

Hi Ashish,


I can't offer an answer as to why function actions can't call non-function actions.  This is probably to do with how things are implemented.


If you are certain that you don't want to use a static entity, why not just have a client action putting those possible values in a list (as you were trying to do), but leave it as a non-function.  It would mean that you have to have a local list in your screen where you want to use them for a dropdown and populate that at time of initialization of the screen or something like that, is that your problem with this ? that you don't want to have a local list as source to your dropdown, you would like to use the function in the List property of your dropdown ?  

You could isolate the dropdown, the local list and the logic to fill it inside a webblock.  That would even make it reusable on other screens where you need the same options for a dropdown ...This would keep your screen clean of all kinds of local variables holding lists, but then again, it would add all kinds of handlers dealing with webblocks reporting on changed values.


Another obvious option is just to have a fetch action in your screen to go and get possible values, you can use fetch result list as source for dropdown, no need to add local lists.


Can you say what your problem is with this kind of solutions, then we can maybe make better suggestions.

Dorine

mvp_badge
MVP
Rank: #89
Solution

Hi Ashish,

Adding to Dorine's comment, I just want to point you to an OutSystems documentation related to this concept.

https://success.outsystems.com/Documentation/11/Reference/Errors_and_Warnings/Errors/Invalid_Client_Function

- Global Client Action set as Function action flow can't contain the below listed node/element 

1) Normal Client/Server Action

2) Server action set as a Function

3) Aggregate node referring to Server/Client Entity as Source

Note: Client Action set as a Function will allow you to include another defined Client Action which is also set as a Function within its action flow


Q2. Regarding populating the Dropdown widget options without referring the static entity, instead using the Output List of a Client action set as a Function, I found a work around (You just have to pass the string in JSON format)

Check this sample app... 

Please find the attachment


Hope this helps you!


Regards,

Benjith Sam

ReactiveAppLab.oml

Rank: #1930

Hi Dourine

Thank you for your response! 

If you are certain that you don't want to use a static entity, why not just have a client action putting those possible values in a list (as you were trying to do), but leave it as a non-function.  It would mean that you have to have a local list in your screen where you want to use them for a drop-down and populate that at time of initialization of the screen or something like that, is that your problem with this ? 

This is something that can be done for sure, would you do this by appending list items one by one as they are going to be random text. I think you have a better solution for sure! 

You could isolate the drop-down, the local list and the logic to fill it inside a web-block.  That would even make it reusable on other screens where you need the same options for a drop down ...This would keep your screen clean of all kinds of local variables holding lists, but then again, it would add all kinds of handlers dealing with web-block reporting on changed values.

The logic is already going to be a part of dynamic rendering for which I am already using a web-block. I don't want to go too deep into event propagation for obvious increase of code complexity.

Another obvious option is just to have a fetch action in your screen to go and get possible values, you can use fetch result list as source for drop-down, no need to add local lists. 

When you say fetch action do you mean data fetch actions.

All those implementation are possible I was searching for a generic solution just throw a random coma separated and get your list.

Thank you for taking time to read, understand and respond!! Much appreciated!


Cheers!




Rank: #1930

Hi Benjith

Thank you for responding! 

I will surely take a look at your solution.

Edited: JSON is a good work around!!

Cheers!