Hi,
For Reactive Web:
What is the difference between creating a Data Action (Fetch Data From Other Sources) and creating a Server Action that does the same thing and then calling that from within a Client Action? They seem to have the same capabilities - although the Data Action you can create the logic straight from the Screen without having to create a specific Server Action - is this the only difference or does it have to do with Synchronous and Asynchronous things etc...?
Also, why is it wrong to call a server action upon initialize but having an aggregate run is fine - when they do the same thing often?
Kind regards
https://success.outsystems.com/Documentation/11/Developing_an_Application/Implement_Application_Logic/Actions_in_Reactive_Web_and_Mobile_Apps
You can get the exact info from the above documentation. Please go through it..
Mahesh Manchala wrote:
Hi Mahesh
Thanks so much for getting back to me! I greatly appreciate it. I had a look for some documentation but couldn't find this, thanks for pointing it out!
Hi Nicholas,
This is document related Server action and Data Action-
https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Implementing_Logic/Logic_Elements/Server_Action
https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Interfaces/Adding_Data_and_Logic/Data_Action .
Also i provide some short answer.
1. Data action is used only within screen and Server action can call multiple screens.
2. When you call multiple server action in client action OS will give warning
3. You can use server side functionaliy in Data action which used diretly on screen
Regards
Rahul
Rahul Sahu wrote:
Hi Rahul
Thanks you so much for posting a fantastic solution to my question. Much appreciated. I will go through the documentation you linked.
Its my pleasure Nick
@Rahul Sahu it has been a while since I asked the initial question, but I wanted to dive a bit deeper and ask you why point 2 (When you call multiple server action in client action OS will give warning ) is true about Server Actions but not Data Actions?Why does OS five an error for multiple Server Actions but not Data Actions? I assume there is some difference I am not aware of?Thanks in advance!
@Nicholas Campbell There are 2 points:a. when you run client action in a screen, OS 11 gives warning about multiple server actions if used in given client action, thats because server actions RUNS ON SERVER SIDE, NOT IN CLIENT SIDE. As we should not have more server actions in client actions which makes app or screen slow to render.
b. when you run data actions in a screen, OS 11 does'nt shows warning about multiple server actions if used in given data actions, that because data actions RUNS ON SERVER SIDE which can derive more server funcationality.
Hope this makes you get more clear .
Thanks Pavans, I appreciate the answer.
I must confess that I still don't understand why Server Actions are "evil" but Data Actions are fine.
As Pavans stated, both run at server side:> server actions RUNS ON SERVER SIDE
> data actions RUNS ON SERVER SIDE
If both are server side actions, why one is better than the other? Is the low-level code generated by OutSystems somehow different in each case? Could Data Actions be more optimized for DataBase connections, for instance?
I'd really appreciate some clarification =)
I think it is more about the purpose of the two.
Server actions can be used to fetch data yes, but primarily they are used to perform operations server-side. In this case, you shouldn't call the server multiple times in a row - you should rather group all server-side actions into one wrapper and call that one wrapper from the client side.
DataActions can be used to do server-side operations but this would be not the usual use - they are primarily data fetches - like an aggregate - which you'll notice can also be placed one after the other in a client action and not get a warning... And sure, you could put all of your fetches in one DataAction and yes that would hit the server less - but that may not give your app neccessarily the best performance as you may want to be able to fetch data at different times etc.
So the reason one gives warnings and the other not because one is better than the other or works diferently (i.e. they both call the server), it is I think because of what the intention of use is...
Hope this helps?
Thanks for your answer Nicholas, it makes sense.
Very glad.
Hello Mahesh and Nicholas,
Both of your documentation is helpful and describing. Thank you for sharing.
Thanks and Regards,
Neha Lawange
'Data action' and 'Server Actions' both of them runs on server despite some basic differences-:
1). The scope of the data action is within the screen while the server actions can be public and can be called from other client/server actions on another screen.2). If the Data Actions are set to execute at start (Fetch=At Start), they can execute in parallel with other logics (client actions or serve actions) in the screen/block. Parallel execution makes it faster over server-action and that is why if we have multiple server actions inside another action, it shows warning (Because they are not in parallel, they are in series and that is why the next action is waiting for previous one the get completed).Apart from above 2 there are few more minor differences -:1). Data actions have 'IsDataFetched’, 'HasFetchError' properties but server actions do not.2). Data actions have 'Fetch' property which we can set to 'At Start' or 'On Demand'. But server actions do not have such things.
3). Server action have 'Public' property which we can set to 'Yes' or 'No'. Data action do not have such things.4). Server actions have 'Function' property which we can set to 'Yes' or 'No'. Data action do not have such things.