hi friends, I'm new to the OutSystems platform,
I trying to create the application with layers (Module).
I created 4 modules,
1-Main (communicates Only with CW. )
2-CW has a block that only communicates with BL.
3-BL has server Action. communicate only with CS
4-CS (HAVE entity and aggregate )
now I have the table widget that is set in CW Module and must use Source Attribute (need aggregate)
now I can't use the CS Module in CW Module as CW Module communicates only with BL.
I created Server Action in Bl have Aggregate that lists employees.
My question is how to link the table widget in CW with Aggregate.
Hello yahia galal.
If you really can not have the CW communicating with the CS module you have to do something like this on BL: First create an Public action like this, where the output is of type List of Employees.
After that, you compile the module and refresh references of CW. Look for this public action that you create. Then, create an DataAction called GetListEmployees (for example), put your server action created on the BL and set the output as list of employees. After that you can start using that output on your table widget.
Best regards, Ana
Hello there Yahia,
From an Architecture point of view, there is no problem at all for the CW module to consume the CS module. Actually, there are some benefits (like better performance) to execute the Aggregates directly in the screen/block, rather to have them in Server Actions.
As long as you don't have architecture violations, you are good to go.
Hope that this helps you.
Kind regards,
Rui Barradas
thank you for your response,
that is actually what I did, consumed CS in cw module,
but our task should follow the flow and communication with the way that I explained it in the question
MAin->CW
CW ->BL
BL->CS
I just responded below.
Once again, it's possible to do that, but not entirely desirable.
i agree with you, your solution is good, but must be made reference of CS in CW,the idea of structure that @Ana Agostinho noted in her solution,that satisfies my total request and makes the separation between cw And CS
Why? I think you are overthinking your solution. There is no architecture best practices that requires you to only access CS from BL. All you need to validate is not to have upwards references and cycle references
I can't even understand the solution behind that supports this architecture decision to be honest.
Specially when OutSystems platform has better performance when executing Aggregates directly in the Screen.
Hi,
Your CS module have entity. So you can expose that entity as read only. To expose you have to set public property to yes and for read only you have to set Expose Read only property to yes.
Now, you can aggregate the data of entity in CW from the CS module.
BL should have business logic or CRUD logic over CS module entities. But for fetching the data, CS can be directly used inside CW.
Hope this help,
regards,
Rahul
I know CS can be directly used in CW,but I need CW to communicate only with BL logic, and BL to Communicate Only with CS.it's possible to use the table widget in CW with the above scenario
It is possible, but not desirable.
You'll need to create a Server Action in the BL that will return the list of the employees (and this you already have).
After you just need to create a Data Action. Inside that Data Action, you will call your BL Server Action:
Back to your Aggregate, you can use the output of the Data Action as a List Source:
thank you for your response, but I have a question,
while we made the data action output in CW with ListOfEmployee
did we make a reference with CS? I think true.
Second :
while making the source of the table to data action output, no data action found to set it
Hello yahia galal,
Once again, I totally support what @Rui Barradas said, there is no problem at all for the CW module to consume the CS module. It is not a violation. You can found the violations rules here: Validating your application architecture
Other thing that it is possible to do, is (once again, not desirable at all, but possible):You can create a structure with only the inputs you want to show or you want to retrieve from the employees, like, for example, EmployeeId, EmployeeName,...After that, you can use it as output of your server action on BL. So, instead of calling List of employees, you might call List of Employees_STR (assuming, Employees_STR your structure).
To select the list, if it doesn't show on the drop use the "Expression editor..." instead of "Select data". There you might find what you want.
i also totally agree with @Rui Barradas , but the task needed as I explained.
thank you ana , that's what I need exactly.
I made it as your explanation and was done correctly.
thank you for your patience with me, with all love, thank you
Always welcome :)
Maybe this is the answer to the question. But the question in the first place doesn't need an answer. It is perfectly fine to reference the CS directly.
Hi yahia galal
You can create the structure of columns which you want to display in table and make use of that list structure as output of data action and then you can use the list structure as table source and also this prevents taking dependencies from CS to CW