138
Views
2
Comments
What is the best way to get the static entity label in the expression? External datab
Question
Application Type
Reactive
Service Studio Version
11.54.52 (Build 63199)

I am using an external database that has a column called 'Status', of type Enum Text(1) with the following parameters:

'p' for Pending
'o' for OnGoing
'd' for Done
'c' for Canceled


Based on this, I created a static entity to store the Label values corresponding to each status, with the id of type Text(1). What would be the best approach, when listing this table on an OutSystems screen, instead of using Enum, to get the label of the static entity using expressions?

Using Reactive Web, I cannot use Client Actions as a function to get the static entity, and I also cannot use Join, as the database is external.

2019-01-07 16-04-16
Siya
 
MVP

One approach to consider involves the following steps:

  1. Create a Screen Aggregate for TicketStatus: This aggregate will fetch all possible statuses.
  2. Create a Client Action named GetLabel: This action should accept parameters 'List TicketStatus' and 'Status', and return the corresponding Label. Within this action, you'll loop through the TicketStatus list to find a match between TicketStatus.Id and the provided Status, then return the matched Label. Note that this action must be marked as a function. Keep in mind that since this is a function, you cannot use actions like ListIndex or List Any, which are not available in functions. Instead, you'll need to manually loop through the list to find the matching status.
  3. Use in Table Expression: In your table, you can call GetLabel, passing the TicketStatus from the Screen Aggregate and the current status from your support ticket list (e.g., `GetSupportTicket.List.Current.support_ticket.status`). This call will return the matching label, which can then be rendered in your table.

Disclaimer: This might not be the best approach, but it's one possible solution to achieve the desired outcome.

2025-11-12 08-18-53
Shriram Bisen

What if the status table (or other table ) has 1000 records, doesn't it will impact the performance? Like if i have similar situation where I have stored the label and all the static text in Static entity and then i want the label to be fetch in expression? as we can't use the get function on UI we have to loop through each record?

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