I have a text field and I need to know if the value the user entered into the field is a Date or a number or not.
How do I do that in outsystems?
SQL Server has isNumeric(@input) and isDate(@input), but this doesn't fly in an aggregate
SyntaxEditor Code Snippet
Search.DataType="VARCHAR" or (isnumeric(SearchString) and Search.DataType="INT") or (isdate(SearchString) and Search.DataType="DATE")
What will fly?
Hello,
Maybe for your case you can use built-in functions like TextToDateTimeValidate(Text) / TextToDateValidate(Text) and TextToIntegerValidate(Text), just to know if you're getting what you pretend check here the built-in functions available. Another solution, already presented on the comment above is using regex for what you pretend.
I hope you find this useful,
Tiago
You can try to use regular expressions
https://success.outsystems.com/Documentation/Development_FAQs/How_to_use_regular_expressions
Thank you, yes, the TextToDateValidate and TextToIntegerValidate are the functions I was looking for, so I marked that as the solution. In the meantime, I converted my aggregate to an Advanced SQL like this, in case it helps anyone else later...
SELECT {Search}.* from {Search} where {Search}.DataType='VARCHAR' or (isnumeric(@SearchString)=1 and {Search}.DataType='INT') or (isdate(@SearchString)=1 and {Search}.DataType='DATE')
https://cambosports24.com