Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Luciano Schiavo
51
Views
4
Comments
Solved
can I reuse the same aggregate ?
Question
I use the same aggregate on many screens. I tried to create a web block but I can not reuse inside the preparation. I have to copy and paste the aggregate even when I create web blocks to reuse code. What I can do ? Can I create a store procedure in a personal environment ? Any other option ? The idea is to maintain only one code.
Curt Raddatz
Solution
Aggregates, like normal SQL, return lists of records. There is no 'object' in your sense of the word. It's tough to help more without knowing more about your application. For example, I'm not sure what creating a bunch of registers (I'm not even sure what you mean by register in this context) has to do with the ability to reuse an aggregate. Maybe its terminology that's getting things hung up. How would you do this on in some other environment if you had a stored procedure that returned a list of records? That's basically what the aggregate is doing. Unless you have some very unusual use case this should be easy. Maybe you can make a small eSpace and post it here and I can look at it and give better advice.
Curt
See solution in context
Curt Raddatz
Create an action that calls the aggregate. Call that action in your preparation. You can have input parameters if needed but you need an output parameter that is the result of the aggregate, typically a list of records. From there you can do anything you want.
Hope this helps,
Curt
Luciano Schiavo
Curt,
when I tried to do that I had to create a bunch of registers on each part of the system. That way I don't have a clear code to maintain. I was thinking to use something where I can access a pointer to use the aggregate as an object. Imagine a Singleton (design pattern) and the use in each part of the system.
Curt Raddatz
Solution
Aggregates, like normal SQL, return lists of records. There is no 'object' in your sense of the word. It's tough to help more without knowing more about your application. For example, I'm not sure what creating a bunch of registers (I'm not even sure what you mean by register in this context) has to do with the ability to reuse an aggregate. Maybe its terminology that's getting things hung up. How would you do this on in some other environment if you had a stored procedure that returned a list of records? That's basically what the aggregate is doing. Unless you have some very unusual use case this should be easy. Maybe you can make a small eSpace and post it here and I can look at it and give better advice.
Curt
Luciano Schiavo
Curt I thought about you said and I tried to create a small eSpace. For my surprise the data type (which is a Record List - the idea of records I told you before) can be reused directly in the table records component. I was complicating a lot thinking only in the structures. Now it is fine.
Thanks so much
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...