Hi everyone, I am creating form instances on one of my applications using rest api .
I need to send a json with several type of value ( boolean , text , numerque , ect )
could any one help me with that !
Hello, @jguirim wassim
You can take your attribute as a text type, which will store all the other datatype values as text and then you can check for whatever type it is or not by using the validate functions for each type to see if the conversion is valid and then you will know if that is a valid datatype or not.
Check the link for data conversion reference. It contains the name of functions and their descriptions.
https://success.outsystems.com/documentation/11/reference/outsystems_language/logic/built_in_functions/data_conversion/#texttodate--texttodate
For example: if you receive a date from the REST API in that attribute, you can use the "TextToDateTimeValidate" action to check if it is a valid date or not, and then you can use it as a date.You can create a common action for this functionality, such as taking the text value as input in a client action, then checking the value for each case of data type like integer, date, boolean, etc using their validate functions. If it is valid in any case, then convert it to that specific datatype and return the value.
Hope it helps.
Regards,
Rishabh Tailor
Hi Wassim,
If am understanding your concern correctly then you want to send multiple values in the API request. If this is the case, would suggest create a single structure for all values want to send the request. Create one input parameter of this structure type and pass the values in it. In API you need to pass the structure in the body of request.
regards