944
Views
16
Comments
Solved
Get function of static entity not available in expression
Question

I have created a static entity in a module and referenced this module in another module. Now I want to use the Get function of this entity in an expression, but surprisingy this is not available:

Can somebody clarify this for me?



Regards,

John.

UserImage.jpg
Pankaj Jain
Solution

You can call the the GetChoiceById in DataAction after GetNotification to avoid asynchronous problem. Please check in attached OML.

2025-11-19 06-14-01
Miguel Verdasca
Champion

You can manually write the name of the function and call the function by passing the parameter.

GetChoice(Id) and if you want some attribute in special, just continuous, GetChoice(Id). ...

2019-12-21 09-09-48
John Heutmekers

Nuno Miguel Verdasca wrote:

You can manually write the name of the function and call the function by passing the parameter.

GetChoice(Id) and if you want some attribute in special, just continuous, GetChoice(Id). ...

I wish it was that simple, but the function isn't recognized:


2025-11-19 06-14-01
Miguel Verdasca
Champion

It's very weird. Have you tried to make an assign using Get to see if it appears? Just to understand the use case you are having and understand what the problem will be. By the way, which version are you working on?

2019-12-21 09-09-48
John Heutmekers

Nuno Miguel Verdasca wrote:

It's very weird. Have you tried to make an assign using Get to see if it appears? Just to understand the use case you are having and understand what the problem will be. By the way, which version are you working on?

It's available in assignments and expression in the module where I created the static entity, but unfortunately not in this module, although you can see in the first screenshot that the function is available in the interface pane.

I'm working with the latest version in Outsystems 11.


UserImage.jpg
Pankaj Jain

Hi John Heutmekers,

In Reactive Web, Server action/Function can not be used in Expressions and technically the GetChoice function is a Server Action/ function.

On other note, I really do not understand why you want to use GetChoice even you can access the Static entity records directly.  Please share your use case to understand your problem in better way .


Thanks.

2019-12-21 09-09-48
John Heutmekers

Pankaj Jain wrote:

Hi John Heutmekers,

In Reactive Web, Server action/Function can not be used in Expressions and technically the GetChoice function is a Server Action/ function.

On other note, I really do not understand why you want to use GetChoice even you can access the Static entity records directly.  Please share your use case to understand your problem in better way .


Thanks.

As I'm rather new with Outsystems, I wasn't familiar with the fact that server actions are not available in reactive. 

My use case: I'm displaying values of a structure in a Form, and one of the attributes is of the type Choice Identifier. If I use this attribute directly then the Identifier ID is shown on the screen, but I want to display the label. 


2020-02-05 04-54-55
Changalrao Bairaboyana

Hello,


Please share the oml file so that we can have a clear understanding and resolve the issue.

2019-12-21 09-09-48
John Heutmekers

Changalrao Bairaboyana wrote:

Hello,


Please share the oml file so that we can have a clear understanding and resolve the issue.


See attachment, although I don't think this is sufficient as the "Choice" static entity is in another module

PMNotificationsReactive.oml
UserImage.jpg
Pankaj Jain

Hi John Heutmekers,

Rather using this approach, You have to join the the two table while creating the Aggregates.

I hope You can implement this is a very simple approach. 


Hope this Helps, Thanks. 

2019-12-21 09-09-48
John Heutmekers

Pankaj Jain wrote:

Hi John Heutmekers,

Rather using this approach, You have to join the the two table while creating the Aggregates.

I hope You can implement this is a very simple approach. 


Hope this Helps, Thanks. 

If I was using tables it would have been that simple, but unfortunately I'm not. This is a scenario where the data is coming from an external system using REST services, so I have to use structures. Do you also have a solution for this kind of scenario?


2020-02-05 04-54-55
Changalrao Bairaboyana

Hello,


Add one action for getting the choices by Id and in the expression pane 

use that function and specify the Id getting from the notification api. 

GetChoicesById(GetNotificationLocal.Notification.SafetyAtRisk).Choices.Label


UserImage.jpg
Pankaj Jain

Hi


If there is not joining is possible then there is one work around as of now, use if function 

If(GetNotificationLocal.Notification.SafetyAtRisk = 1, "X",If(GetNotificationLocal.Notification.SafetyAtRisk = 2, "J","N"))

I know its not a good but as of now only can think of it. 


Thanks.

2021-03-05 13-56-11
Ricardo Pereira
 
MVP

Hi John,


Can you prepare the structure to receive the label and not the Id, and, when your getting your data from REST service, map the value that you want in the structure (getting there your label and send to the structure the correct label)?


Hope this can help.


Best regards,

Ricardo

2020-01-08 08-43-00
Rahul Kumar

Hi John Heutmekers,


I have applied some of my approach in your Oml .

Hope it may help.

Thanks ,

PMNotificationsReactive.oml
UserImage.jpg
Pankaj Jain
Solution

You can call the the GetChoiceById in DataAction after GetNotification to avoid asynchronous problem. Please check in attached OML.

2019-12-21 09-09-48
John Heutmekers

Hi guys,


Thanks for all your time and valuable suggestions. I have used the suggestion of Pankaj, which does what it needs to do. Although I really feel this is a "design mistake" of Outsystems to not have this Get function of static entities available in Reactive apps.

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