34
Views
5
Comments
Custom Built in functions
Question

Hello Everyone,

I was wondering if there is a way to create an custom build-in function in OutSystems. For example, have the following logic that will capitalize the first letter in my data before I send it to be saved by the database - please see below.

In this example, I am also using OutSystem's current built in functions : The input variable is named "Input"


ToUpper(Substr(Input,0,0)) + Substr(Input,1,Length(Input))


Is there anyway I would be able to convert this into one of the function that I can run on client side since I am using reactive web.


Thanks

Rank: #91

Hi Otis,

You can create one client action in Logic


And pass input parameter and take one output parameter which return your expected result and you can use this client action.


Hope this will help you.

Regards
Rahul

Rank: #908

Thanks for the response Rahul,

I actually did that but my issue is that I have a tons of input fields that I would like to do this with...using a a function, I could add them all to 1 assign which would make life a lot easier I believe. 

Any suggestions in this use case?

Rank: #91

Hi Otis,

i dont think so you can do it by function because in case you need to pass inputs.

But you can do this by Javascript in simple way-

https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript 


Regards

Rahul

Rank: #373

Hi Otis, 

You can do this in 1 assign by calling a function for each field that receives the current value as input, no problem.
Btw, in the Forge there are also a lot of string manipulation components already.

Regards,
Lennart

mvp_badge
MVP
Rank: #56

Hi Otis,

Please look at the oml , you can create one function and pass multiple input as well while calling it inline. The only limitation is it can only return one value (can only have one output parameter )


Regards,

-PJ-

Function.oml