0
 Followers
2
 Likes

Try/Catch function, similar to the IF()

Backend
New

Let me start by describing a scenario that happens often that this function will solve:

You create a Screen. You add a piece of text that is from a lookup table. You have an ID of the item, let's say Countries. You create the Countries entity, which gives you a GetCountry() method.

If you pass a ZERO to the GetCountry() method, or any value for which there is no country, you get an Error from OutSystems that looks like this:

In this case, if I had been able to say:

CountryCode = 46;

TryCatch(GetCountry(CountryCode).Country.Name,"Invalid Country Code " + CountryCode)

Life would be lovely.


Created on 13 Nov 2018
Comments (1)

Changed the category to Backend


views
155
Followers
0