Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with a "\" in a script 1

Status
Not open for further replies.

jmpurser

Programmer
Nov 19, 2001
12
US
I'm parsing a tab delimited file to enter the data fields into a point of sale system. My problem is that when a field has a "\" in it only the part after the "\" gets entered. For instance AAA\BBB appears as BBB. I know "\" is a reserved character and I read about escape characters somewhere in the manual but coudln't find it yesterday and I'm running out of time. Can someone tell me how to deal with this please?

Thanks,

John Purser
 
How are you passing the information to the POS system? I can't think of a reason that only the text after a \ would be sent and not the entire string, but maybe I am missing something. It might be helpful to post the snippet of code that is responsible for sending the data.

 
There may be a more eloquent way, but I tried to think fast. Test this script and see if the same method would apply to your problem:

Proc Main
String FIRSTHALF = "He goes by Robert", SECONDHALF = "Bobby", SLASH
Strputc SLASH 0 47 ;47 is ASCII Value for /
Strcat FIRSTHALF SLASH
Strcat FIRSTHALF SECONDHALF
UserMsg FIRSTHALF
EndProc

Robert Harris
Communications Advantage
 
My misteke, the slash is the wrong way. The right CHR value is 92

Proc Main
String FIRSTHALF = "He goes by Robert", SECONDHALF = "Bobby", SLASH
Strputc SLASH 0 92 ;92 is ASCII Value for Strcat FIRSTHALF SLASH
Strcat FIRSTHALF SECONDHALF
UserMsg FIRSTHALF
EndProc
Robert Harris
Communications Advantage
 
One other thing to check is to make sure that the string is being read correctly from the input file. This would let us narrow down just where the text in front of the backslash is being dropped.
 
Well you guys are just about useless!

Not one of you thought to suggest that I WAS A MORON!!!

<SELF FLAGELLATION>
What I did was simple. You see the catalog number I was trying to enter is a key value, no duplicates. Since it can throw an error my code has to handle I moved it to a separate function so I could check for problems like duplicates, timing, etc. I was so pleased with my cleverness that I NEVER WENT BACK AND CALLED THE FUNCTION!!! So the next field (Manufacturer's number) was entered for the catalog number and for this company's format the manufacturer's number is the part of the catalog number after the &quot;\&quot;.

In the words of one of the great thinkers of our time &quot;DOH!!!&quot;

</SELF FLAGELLATION>

Much thanks to all those who tried to help. Next time I'll try and assume that it's a *PEBKAC situation and not yell for help until I'm certain it's not!

John Purser

*Problem Exists Between Keyboard And Chair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top