Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
MarcinW
- Junior Coder
- Posts: 24
- Joined: Thu Jul 23, 2020 11:24 pm
Post
by MarcinW » Tue Sep 29, 2020 10:27 am
I tried to use this solution for using double quotes in if statements
https://www.mjtnet.com/blog/2008/07/24/quoting-quotes/
I tested it with two other developers. Two of us using 15.0.09 version of MS, one using 15.0.13.It does not work for any of us, we get the unknown identifier error.
We tested it further and instead of using StringReplace, we initialised the mystring_2 variable with additional quotes directly:
Code: Select all
Let>mystring_2="your name is ""Sally"""
This works.
Does anyone know what the issue is? I noticed the blog entry is pretty old, is this way of handling quotes no longer supported? Any alternatives for handling quotes in explicit if statements?
-
Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Post
by Dorian (MJT support) » Tue Sep 29, 2020 11:34 am
I'm currently investigating this, and have asked Marcus for his input.
Although the current version when that article was written in 2008 was v10, and it was changed in v12.
Version 12.0.0.30 17/05/2010
Quotes in strings passed to complex expressions are now automatically escaped
However, I am still getting errors if the " is either the first or last character in the string.
//Unknown Identifier
Code: Select all
Let>mystring=Your name is "Sally James"
Let>mystring2=Your name is "Alan Evans"
If>{%mystring% <> %mystring2%}
//Do something
MDL>!!
Endif
//i not appropriate
Code: Select all
Let>mystring="Sally James" is your name
Let>mystring2="Alan Evans" is your name
If>{%mystring% <> %mystring2%}
//Do something
MDL>!!
Endif
//Working code
Code: Select all
Let>mystring=Hello, "Sally James" is your name
Let>mystring2=Hello, "Alan Evans" is your name
If>{%mystring% <> %mystring2%}
//Do something
MDL>!!
Endif
-
MarcinW
- Junior Coder
- Posts: 24
- Joined: Thu Jul 23, 2020 11:24 pm
Post
by MarcinW » Wed Sep 30, 2020 4:35 pm
Hi Dorian, thanks for your reply. Right now we have a workaround where we replace quotes from a string with alternative quote symbols, then perform any logic on it and then change it back. It works but it would be great if we would not have to do that. Please let me know if there'll be any update regarding this issue.
