248
Views
4
Comments
Solved
Possible to define a function that returns an Integer or Long Integer Identifier?
Question
Application Type
Reactive
Service Studio Version
11.53.10 (Build 61105)

Ideally, I'd like to write "TextToIntegerIdentifier" and "TextToLongIntegerIdentifier" functions (client and server actions) which would first attempt to convert a Text input parameter to an Integer or Long Integer respectively, and if successful return that value cast as a generic Integer Identifier or Long Integer Identifier type (otherwise, return NullIdentifier()); however, it does not seem to be possible to set the variable type of the output parameter to a generic Integer Identifier or Long Integer Identifier. Is there a way to do this?

Thanks!
Kirk

2019-09-30 07-35-56
Aurelio Junior
Solution

Hi Kirk,

OutSystems doesn't have a "Generic Identifier" data type, so you'll have to use Integer/Long Integer as the data type for your function's output. This will result in a warning message when you use that function in an aggregate filter, but I'd say you can safely ignore it. If you don't want to ignore the warning, you could wrap the function call with "IntegerToIdentifier/LongIntegerToIdentifier".

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

I am curious, why you need such functions?

Regards,

Daniel

UserImage.jpg
Kirk Sealls

Need’s a strong word, it really would just simplify things for me a bit. I would like the ability in one single function call filter an aggregate by comparing a string input parameter to the Id of one of the entities. I can’t really convert the Id to Text, because I’m padding the Id with leading zeros, and so if I convert the Id to a string it’ll fail to match Id 1 if I enter “0000001.”

I realize I can fairly easily accomplish what I’m trying to do by first converting the Text to an Integer or Long Integer, then using the appropriate function to convert the output to an Identifier, but I’m wondering if there’s a way I can get it done with one function call.

2019-09-30 07-35-56
Aurelio Junior
Solution

Hi Kirk,

OutSystems doesn't have a "Generic Identifier" data type, so you'll have to use Integer/Long Integer as the data type for your function's output. This will result in a warning message when you use that function in an aggregate filter, but I'd say you can safely ignore it. If you don't want to ignore the warning, you could wrap the function call with "IntegerToIdentifier/LongIntegerToIdentifier".

UserImage.jpg
Kirk Sealls

Thanks, that’s what I’ve done.

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