1
 Follower
1
 Like

Allow any server action (that's a function) to be used in Aggregate or AdvancedSQL

Aggregates & Queries
New

As the system is built, if we have Business Logic encapsulated in a Server Action, then to include the output of that business function in a aggregate, we must first generate an aggregate with an empty field, then loop through each of the records and call the Business Logic function on the data in the aggregate row and assign it to the field in the aggregate.

This prevents us from sorting on that field. It also creates a significant performance hit because all the logic cannot be run in the database.

Imagine this being implemented as a User Defined function in SQL Server, or a computed column. It would behave the same way.

EXAMPLE: Server Action (Function) named "CalculateCorporateRanking"

INPUTS: UserID

OUTPUT: CorporateRanking

Corporate ranking is calculated based on business logic implemented in the function.

REQUEST:

Display a web page with all active employees and their CorporateRanking. Allow sorting on CorporateRanking ASC or DESC.


As built, outsystems would require us to download ALL employees, run the function CalculateCorporateRanking(UserID), create a structure with the UserId and CorporateRankingCalculation, then sort the entire list.


After this idea is implemented, we could build one aggregate and allow the database to do the sorting and reduce network traffic while improving the User Experience.




Created on 29 Jan
Comments (1)

Changed the category to Aggregates & Queries


views
55
Followers
1