Is there any way using which we can check the datatype of the input ?
Question
Application Type
Reactive

We have built-in functions for data conversions but in my case I don't know what type of data will be coming so is there any way for checking the dat type? 

Solution

Don't you own the server action? You can set the parameter to Text data type and work on the value sent which will be received as text no matter if it's "378643" or "20/07/1991".

Hi Neha,

are you receiving the input in a screen, action, web service?

Regards

Hi Jose,

In a server action.

Your input parameter should be text data type and there are functions to validate if a text parameter can be converted to another type:

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Data_Conversion

TextToDateTimeValidate(Text)Returns true if Text 't' can be converted to a Date Time value.
TextToDateValidate(Text)Returns true if Text 't' can be converted to a Date value.
TextToDecimalValidate(Text)
Returns true if Text 't' can be converted to a Decimal value.
TextToIntegerValidate(Text)
Returns true if Text 't' can be converted to an Integer value.
TextToLongIntegerValidate(Text)
Returns true if Text 't' can be converted to a Long Integer value.
TextToTimeValidate(Text)
Returns true if Text 't' can be converted to a Time value.


Regards


Thanks for reply Jose.But what if i dont know the input type is of text ? How to check that.?

Solution

Don't you own the server action? You can set the parameter to Text data type and work on the value sent which will be received as text no matter if it's "378643" or "20/07/1991".

Hi Neha ,

If the text is on an input field you can associate a client action and check the type with JS. 

typeof(MyVariable).

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