Quote in string problems
Question

Hi,

I've been browsing around multiple posts regarding the double quotes (") inside a string where as to my understanding writing 4 quotes results in 1 quote in a string. I created a client sided function that managed to do just that, but when i did it on server side it did not work..

I even attempted to use the replace function to replace 2 quotes with 1, but that changed nothing.

Replace(joinedStores, """""", """")

Anyone have any idea of what could be wrong?


Client side (working)


Server side (not working)


Ok, I see what you mean now, it's about how it is shown in the debug window.  I can reproduce the same, but this is just about how a double quote is represented during debugging, and I guess in server debug it is different then in client debug because of other underlying technology (as in .net vs javascript).

But I can't see a difference in how the software works, if I take the same string with double quotes in it, and I code some server logic and some client logic to find " in it and to find "" in it, both on server and on client side, it finds a ", not a "", even if it looks different in the debug window.  So representing the string on screens, saving the string in database, applying function on the string, all seem to see a ", and not a "".

So i have a test where a string with double quotes is entered, the built in function Index is executed on both client and server side, and the value is stored in the database.

this is how debug looks on client side

this is how debug looks on server side, so yes, although you see a lot more quotes here, it still works correctly.

And this is what is stored in the database

 All above works as expected, except that it looks a bit weird in debug window.  So the question is, what are you doing with this exactly, that doesn't work as expected ?

Dorine

Hello,


Yesterday I had the same problem, but I ended up solving it on the client side. On the server side I advise to use single quotes (" ' ") if possible. If that's not possible I don't know how to solve the problem.

Regards,

Jorge Rodrigues

Sadly single quotes does not work in my scenario.

What is the code you are creating for? in which case do you need the quotes? To create a json?

Hi Guys,

I'm trying to recreate your problem in an example module, but can't see the same as you.  Can you share an oml where this is happening ?

See attached oml, I am appending values into a string with double quotes, both on the server and client, and it all works as I would expect.  Can you see what is different with what you are doing ??

Dorine


EDIT : Viktor, are you sure that your Append variable doesn't already have double quotes in it on server side???

QDRAddingDoubleQuotes.oml

I assumed that my append vaiable already had quotes, but as the variable "Query" (which is also appended to in the same loop), just without the double quotes, show it does in fact not contain quotes.

I guess I could try to recreate it in a new module and share that if it doesn't work, but I don't think I've created the current module correct enough to be able to share it, as it might contain internal company data that I do not want to share (still kind of new to OutSystems).

It doesn't necessarily have to be a server-problem, as you've apparently got it to work. I'm just guessing as that was the only difference I found when comparing the two. I just thought there could be an explaination as to why it behaves like this.

I was not able to start your oml, but I created it on my own, it seemed to work visually in the program, but when i debugged it, it still said that the string had double quotes. The double quotes remain when I create the query and try to query our data layer.

Hi Viktor,

If you successfully created your own .oml that possible to share. Can you share it here then we can take a look?

Cheers,

Khuong

If you debug the "test" server action (think my breakpoint on the end step should be there), you can see that the variable has 2 quotes, but when you view it on the screen it changes to 1.

QuoteProblems.oml

Ok, I see what you mean now, it's about how it is shown in the debug window.  I can reproduce the same, but this is just about how a double quote is represented during debugging, and I guess in server debug it is different then in client debug because of other underlying technology (as in .net vs javascript).

But I can't see a difference in how the software works, if I take the same string with double quotes in it, and I code some server logic and some client logic to find " in it and to find "" in it, both on server and on client side, it finds a ", not a "", even if it looks different in the debug window.  So representing the string on screens, saving the string in database, applying function on the string, all seem to see a ", and not a "".

So i have a test where a string with double quotes is entered, the built in function Index is executed on both client and server side, and the value is stored in the database.

this is how debug looks on client side

this is how debug looks on server side, so yes, although you see a lot more quotes here, it still works correctly.

And this is what is stored in the database

 All above works as expected, except that it looks a bit weird in debug window.  So the question is, what are you doing with this exactly, that doesn't work as expected ?

Dorine

Oh, that clears things up. Turned out i had a small misstake in the GraphQL query and i assumed it was the 2 quote problem again, as i got a very similar error message as last time and saw the 2 quotes when debugging. But it turns out it just shows 2 quotes when debugging, but only passes 1 quote when you use it.

Thanks a lot for your help! :)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.