Hacking Aggregates in OutSystems

OutSystems automatically offers basic CRUD methods for accessing the data, and you can develop your own aggregates. OutSystems displays a preview of the fetched data so you can see how modifications affect the outcomes right away.

Custom SQL queries can also be used to retrieve data in OutSystems. As a result, the access pattern is extensive. This demonstrates that programming with OutSystems necessitates coding skills and is not all magic.

If you are like me, who prefers to use aggregates as much as possible instead of the SQL widget, but, not able to do so because of some missing features like the ability to query with an IN clause, let me show you some hacks.

Consider that we have an Employee table linked to a Department table as depicted in the following Entity Diagram:

Hacking Aggregates in OutSystems

The diagram below shows how a typical screen listing would look like:

screen listing
screen listing

Let us say we like to add a special filter to get the list of employees by Department Name.

We may add another input box and bind to a variable, say — “Department Filter”.

Department Filter
Department Filter

Typically, we would modify the aggregate to accommodate the department filter like below:

department filter
department filter

This works fine when we want to filter by any single department name, like below:

single department name
single department name

However, if we want to modify the same aggregate to allow more than 1 department name (as we do in an SQL widget with comma-separated values using IN clause), there is no out-of-the-box way to do so.

So what is the solution?

Let’s hack it. Just use the Index function in the filter like below:

Index function
Index function

Now try to filter by multiple department names with a comma separator. And voila! You got what you wanted without writing a single line of SQL or having to use the SQL widget.

Just note that this may not work as expected in all the cases and may require some additional hacks. In case, the department name for example had similar words. For example, while searching for only the “Research” department, the result would also include “Research & Development” department values.

Conclusion

The real advantage of low-code is that it allows more individuals to code because the learning curve isn’t as steep. That isn’t to say you don’t need to know about software architecture; you do. Otherwise, maintaining and developing the systems will become extremely difficult.

This means that businesses will develop more applications both internally and outside. As a result, rather than replacing existing solutions, there will be more of them, and applications will be developed by a larger set of developers. As a result, the demand for new functionality and APIs for other systems, such as existing backend solutions, would increase.

Thanks for taking the time out to read this blog! Keep an eye on this space for a series of more interesting blog posts around OutSystems in the coming days.

Disclaimer: The views and opinions expressed in this blog are those of the author and do not necessarily reflect the official policy or position of Innominds.

All trademarks, logos, and brand names mentioned in this blog are the property of their respective owners. All company, product, and service names used in this blog are for identification purposes only. Use of these names trademarks, and brands do not imply endorsement by Innominds.

Note:- Originally Published on Innominds Website.

Innominds is an AI-first, platform-led digital transformation and full-cycle product engineering services company headquartered in San Jose, CA.