17
Views
9
Comments
Solved
Data Conversion
Application Type
Traditional Web
Service Studio Version
11.10.9 (Build 38645)

Hi,

i'm new to OutSystems and i'm searching for replacement or a way to do some Conversion 

i have a Text var ="123456789CW123" for example and i need to replace every Char with its ASCII value.

i tried to use TextToBinaryData but it return Binary and i can't add it to the Text any how.


Thank you

Rank: #54
Solution

Hi Tamer,


Now that I understood your need better, I went ahead and created an extension which does the trick. See below a demo:



I am sending you an .OAP in attachment with the extension and the demo.


Hope it helps.


Kind Regards,
João

SwapCharsByASCIIValue.oap

Rank: #246

I am not sure what you are trying to achieve. do you want the text to be converted from utf-8 to ascii or do you want the ascii-codes for each character?


The other way around is standard available in outsystems: chr(c). Ofcourse its very easy to create it yourself, but i would guess something already exists in the forge, hence my question.

Rank: #13105

Hi Stefano,

what exactly i need is to check for any letter in the Text and replace it with its ascii code.

var ="123456789SA123" => to be"1234567898365123"

chr() take integer to get the corresponding letter, i need the reverse action.

Thank you

Rank: #54

Hi Tamer,


You can try to use the ASCII Utilities or HEX_ASCII_Converter forge components, they should provide actions for your purpose.


Hope it helps.


Kind Regards,

João


Rank: #13105

Hi João,

it's not what i needed, Thank you.

Rank: #54
Solution

Hi Tamer,


Now that I understood your need better, I went ahead and created an extension which does the trick. See below a demo:



I am sending you an .OAP in attachment with the extension and the demo.


Hope it helps.


Kind Regards,
João

SwapCharsByASCIIValue.oap

Rank: #246
Rank: #246

If you need this servserside you need to create an extension.

Most easy way is to use javascript:

function ascii (a) { return a.charCodeAt(0); }
Rank: #13105

Thank you both for your responses.

i was trying to avoid creating an extension, by finding built-in methods /API to do so.


Thank you again 

hi @João Marques @Stefano Valente ,

Both of you are awesome!

Learning a lot from you both.

Regards,

Chris