04-17-2009 08:21 AM
Hi All,
I really don't know how to phrase this question correctly, but here is my question.
I have a DotNet object and a method someone else wrote to write to an Excel file. I want to use something like: "C:\Program Files\WMT\Sequences\ProductX "+ Str(StationGlobals.File_Count) +".arc" in a local or global string variable, but I always get a illegal characters in filename. If I put that into the string filename parameter in value -- it works. The variable File_Count is a number.
TIA,
Jim
Solved! Go to Solution.
04-17-2009 09:27 AM - edited 04-17-2009 09:28 AM
In a string constant in an expression, the backslash character is the escape character. To put a real backslash, you double it:
"C:\\Program Files\\WMT\\Sequences\\ProductX "+ Str(StationGlobals.File_Count) +".arc"
From the Expression Browser Help for string constants:
You can use the following escape sequences in string constants:
\\ Backslash
\n Line Feed
\r Carriage Return
\xNN Hexadecimal character code
\NN LabVIEW style hexadecimal character code
\" Quote
\t Tab
04-17-2009 09:43 AM
Hello James,
Actually i am very new to TestStand. So maybe I may not understand the Thread Problem properly.
I just framed one Seq from whatever i understood..i tried using single backlash..but my string was formed properly..why so?
04-17-2009 10:03 AM - edited 04-17-2009 10:04 AM
04-17-2009 10:22 AM
Yes i checked it James..you are right!!
Thanks for the reply
04-17-2009 11:36 AM
Hi James,
Thanks for the help, but my problem seems to be from including variables in a variable (and a conversion to string). I hope the following example will show the problems I am having.
Thanks,
Jim
04-17-2009 11:55 AM
Only use escape characters in string constants in expressions.
Don't put them in your local string variables when you edit their values, even if you use the locals as variables in an expression.
04-17-2009 12:28 PM
Hi James,
How do I put a reference a local variable in a local variable? I want to do something like this for the filename variable in my previous example:
"Serial Number " + Str(StationGlobals.File_Count) + " .txt"
Thanks,
Jim
04-17-2009 12:40 PM - edited 04-17-2009 12:40 PM
Put the reference in your expression itself, or compute the value of the second local using an another expression that references the first local.
The expression in your first post would work fine when used as an expression if the backslashes were escaped (doubled).