Call server action dynamically 

Call server action dynamically 

  

Hi,

I have three server action and one local variable

ServerAction1()

ServerAction2()

ServerAction3()

TempNumber=0

If TempNumber=1 then it will call ServerAction1()

If TempNumber=2 then it will call ServerAction2()

If TempNumber=3 then it will call ServerAction3()

But how can i manage it dynamically without using Switch or If Else conditional loop. Is it possible in outsystem ?

Thanks & Regards

DM Singh


Hello DM,

I'm not seeing how, in logic (Screen/Server action) you could select a different action depending on the value of a parameter without the use of IF's or SWITCH's (maybe there is...).

What's the problem with the IF's or SWITCH's?

Cheers,
Eduardo Jauch

Eduardo Jauch wrote:

Hello DM,

I'm not seeing how, in logic (Screen/Server action) you could select a different action depending on the value of a parameter without the use of IF's or SWITCH's (maybe there is...).

What's the problem with the IF's or SWITCH's?

Cheers,
Eduardo Jauch

Thanks for reply.

I have requirement to call server action based on some number or condition. I have already mapped TempNumber to server action in Entity like below 

TempNumberServerActionName
1ServerAction1
2ServerAction2
3ServerAction3


I have aggregate SQL it will fetch current ServerAction name based on filter TempNumber and it will call automatically . Is it possible ?

Solution

Hi DM,

Well, it is possible, but not from inside the OutSystems.
you have to create an extension, call the extension function/action passing the parameters for it to call the action.

See this.

Hope it helps.

Cheers,
Eduardo Jauch

P.S.: But as the Server Actions will be known at design time, I personally prefer to use the SWITCH.

Solution