Loss of data returned by server action

Hi,

I have a server action, that returns list (output variable). Each element in nested structure. When I debug, I am able to see values in server action in output variable. However as soon as when output is back on client side, values disappear.

For example.

output variable is Employees which is nothing bug List of Employee(structure), within my Employee structure I have 3 attributes

1. BasicEmployee (structure) - firstname, lastname, email address)

2. skillsets (structure - list of skillset)

 2.1 skillset (structure) - category, skill, experties, points, score etc

3. skillset total (structure) - total points, total score, etc (totals for above 2, consolidated values)


while debugging on server side, entire Employee structure is filled with values, however as soon as, when it comes on client side, values disappears (only certain values like firstname, lastname and total score remains intact, all other values disappears). 

When I open the returned variable in debug window it shows values "unavaiable" in all listitem of skillset.


Also one more observation is, when server action returns the data, if there are 10 records then it shows currentrecordnumber = 9.

Can someone help me in finding out why values that are available in server action disappears as soon as it comes on client side?


Regards,

Sachin


Hello SACHIN,

About the Current Row Number it can be zero based, so starts at 0 and goes to 9, which means 10 items.


Regarding the nested values, are you appending the values in the list in the correct way?
Can you provide a screen shoot or your .oml file so we can help?


When using nested values make sure you are appending the itens in the current record you are editing.


Cheers and Regards,

RR :)

Thanks Raphael for responding.

Attaching .oml file for your reference. Please refer "EmployeeScreen" where I am calling client action and from client action server action is being fired.

Server action returns the result back to client action, but data is lost between this, kind of handover. It would be great if you can help me out


Regards,

Sachin


Hi Sachin,

Can I ask a couple of questions?

  • Are you running your application on a Personal Environment or on an Enterprise Environment?
  • Of all the data of that list with missing values, what data are you actually using on the screen?

Cheers

Solution

Hi Sachin,

I guess, the absence of data in the client side logic which you observed is because of the platform optimization pattern i.e. In case if the respective List type variable's field/attribute value is not mapped or referred in any of the logics or in the UI widget then the platform by itself won't hold/keep the value for the same field because of that very reason you found the value "unavailable" in the debug section.

Pleas refer the attached updated .oml

Code Changes: Just introduced two columns in the Table widget - skillset and TotalScore (in the Employee Score Screen) with Expression widget which is mapped with/referencing all the attributes value which where not referenced/used previously (L_EmployeeScoreCards -list type variable )


Hope this helps you!


Regards,

Benjith Sam

Solution

Jorge Martins wrote:

Hi Sachin,

Can I ask a couple of questions?

  • Are you running your application on a Personal Environment or on an Enterprise Environment?
  • Of all the data of that list with missing values, what data are you actually using on the screen?

Cheers

 Hi Jorge,

Below are answers for your questions

1. I am using personal environment

2. I wanted to use all the data that I am returning from server action.

Regards,

Sachin


 

Benjith Sam wrote:

Hi Sachin,

I guess, the absence of data in the client side logic which you observed is because of the platform optimization pattern i.e. In case if the respective List type variable's field/attribute value is not mapped or referred in any of the logics or in the UI widget then the platform by itself won't hold/keep the value for the same field because of that very reason you found the value "unavailable" in the debug section.

Pleas refer the attached updated .oml

Code Changes: Just introduced two columns in the Table widget - skillset and TotalScore (in the Employee Score Screen) with Expression widget which is mapped with/referencing all the attributes value which where not referenced/used previously (L_EmployeeScoreCards -list type variable )


Hope this helps you!


Regards,

Benjith Sam

 Thank you, will try and let you know

 

Benjith Sam wrote:

Hi Sachin,

I guess, the absence of data in the client side logic which you observed is because of the platform optimization pattern i.e. In case if the respective List type variable's field/attribute value is not mapped or referred in any of the logics or in the UI widget then the platform by itself won't hold/keep the value for the same field because of that very reason you found the value "unavailable" in the debug section.

Pleas refer the attached updated .oml

Code Changes: Just introduced two columns in the Table widget - skillset and TotalScore (in the Employee Score Screen) with Expression widget which is mapped with/referencing all the attributes value which where not referenced/used previously (L_EmployeeScoreCards -list type variable )


Hope this helps you!


Regards,

Benjith Sam

 

Hi Benjit,

Since it is a server action running the aggregates and returning a structure, are you sure that the items are optimized? 

So far as I know when using an aggregate inside a server action and mapping these fields to a structure being returned should return all the values because it is already used by the action.

It is even aligned with one of the Queries Best Practices:


This behavior has changed in Reactive Apps?


Also when the return is optimized is shows optimized in the return right?

We can confirm it in this post

Hi Raphel,

As per the Best Practice documentation statement.. 

Never create an action to execute an Aggregate. When the query is isolated in an action by itself, the Platform can't optimize the number of fields to be retrieved. 

(The client side optimization of the Server action Output parameter value is not mentioned here..)

Observations:

- The executed query/Aggregate defined inside the server action is not optimized i.e. all the field value will be fetched on the query execution as a result we get the entire field/column value of the involved entity as the result-set/Output List

- Inside the Server action the Output parameter is assigned with the same query result-set values 

- Within the server side/action scope, we can observe that the Aggregate result-set values and the Output parameter (list) value filled with complete values as shown below


- But when we observe the same server action node output parameter values, coming to the client side the data gets optimized by itself (refer the below attached screen clip) i.e. the value of those field which has been referenced in the client side will only get persisted or retrieved as the Server Output List parameter value

Sorry, I don't have any documentation reference to share with, which states the such type of Platform Optimization features...

Hope this helps!


Regards,

Benjith Sam

Hi Benjith,


Thanks for the explanation,

Nice to know!


I really thought it was not optimized in Client Side.

So in the end, server actions being called in the client side behaves like an Aggregate in Traditional apps.
It also optimize the values for only what is being used?

Raphael Ranieri wrote:

Hi Benjith,


Thanks for the explanation,

Nice to know!


I really thought it was not optimized in Client Side.

So in the end, server actions being called in the client side behaves like an Aggregate in Traditional apps.
It also optimize the values for only what is being used?

You are welcome, Raphael :)

Yes, it's true and that's how it worked :)


Regards,

Benjith Sam

Benjith Sam wrote:

Hi Sachin,

I guess, the absence of data in the client side logic which you observed is because of the platform optimization pattern i.e. In case if the respective List type variable's field/attribute value is not mapped or referred in any of the logics or in the UI widget then the platform by itself won't hold/keep the value for the same field because of that very reason you found the value "unavailable" in the debug section.

Pleas refer the attached updated .oml

Code Changes: Just introduced two columns in the Table widget - skillset and TotalScore (in the Employee Score Screen) with Expression widget which is mapped with/referencing all the attributes value which where not referenced/used previously (L_EmployeeScoreCards -list type variable )


Hope this helps you!


Regards,

Benjith Sam

 Thanks Benjith, it worked, when I included the fields as output, data is being shown.


If a warning has been given by outsystems, that returned fields are not rendered, so we could guess, the reason for the issue. However, Thank you very much for the solution


Regards,

Sachin

 

SACHIN SALVEKAR wrote:

Thanks Benjith, it worked, when I included the fields as output, data is being shown.


If a warning has been given by outsystems, that returned fields are not rendered, so we could guess, the reason for the issue. However, Thank you very much for the solution


Regards,

Sachin

You are welcome, Sachin :)

Happy to help you :)

Yes, I do agree with you.. a default info note/comment while creating the server action will help :)


Kind Regards,

Benjith Sam