Any ideas to make this logic of Preparation more concise?
Application Type
Traditional Web

I'd like you to tell me about good ideas to improve the below.


I have this kind of List.

The spec is

according to "PlotPosition", the "PlotValue" shows in the cell.

Let's say "PlotPosition" is 3.2 .

This means that Row is 3 and Column is 2.

So, for example, stuff that have 3.2 of "PlotPosition" are supposed to show in the cell where Row is 3 and Column is 2 on the Screen "Matrix" like below.

Others are also the same way.


I implemented the logic in Preparation action but it looks complicated.....


I was thinking about any ways to improve it but I couldn't figure out.

I'm wondering if there is any good solution to make the logic more simple and concise.


Do you have any good ideas?

I was wondering if you could give me any advice.

I've attached the oml file for more information.


I look forward to your comments.

Kind regards,

CellRowTable.oml

mvp_badge
MVP
Solution

Hello there Tsubasa,

Hope you're doing well.

Looking into your code, it is never a good practice to have long flows of logic (in this case, we're talking about the Preparation of the screen).

This is associated to a lot of reasons, but the main reasons are the legibility of the code itself and maintenance of the app.

My first suggestion would be the creation of a Server Action that encapsulates the Switch and several List Appends from your Preparation's logic. You should set a good description for this Server Action.

Back to your Preparation, you may swap that entire part of the flow for that Server Action. This will reduce the length of the flow and the code will be easier to read and understand.


You may do this exercise with other parts of the code, when you feel that you have complex and long flows of logic. Don't forget to add some descriptions and comments as well :)


For more information, you may check this documentation:

https://success.outsystems.com/Documentation/11/Developing_an_Application/Reuse_and_Refactor/Use_Actions_to_Encapsulate_Logic


Hope that this helps you!


Kind regards,

Rui Barradas

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.