Search code examples
outsystems

How to write in a database a text with " in OutSystems


I have a problem in OutSystems saving text into database, which contains ".

For example user inputs in a text field the text "c". In a debugger i can see that it converts into text="""c"".", probably to escape the " character in expressions.

And when i write it in a database it is already c"".

How to handle this situation correctly?


Solution

  • It looks like the outer quotes are trimmed of when showing the value in an entity.

    This is speculation, but i think Outsystems uses a trim(") function on database values due to underlying Outsystems mechanics. The trim function trims the quotes of your input because your value contains quotes at the start of your value. The trim function removes all characters at the start and end of a string.

    However it does seems that the correct value is showed when you use the value in your application. So in the database it's stored correctly.

    • Input: "c".
    • EscapedInput (how it's stored in the database: ""c"".
    • Debugger view (adds quotes to a string): """c""."
    • Entity view (trimmed escaped string): c"".
    • database value shown on your site: "c".