Get function of static entity not available in expression

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.

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). ...

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:


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?

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.


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.

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. 


Hello,


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

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. 

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?


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

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


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.

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

Hi John Heutmekers,


I have applied some of my approach in your Oml .

Hope it may help.

Thanks ,

Solution

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

Solution

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.