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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Micros Sim Find and Replace code

Status
Not open for further replies.
Mar 17, 2010
78
US
Hi, I have a SIM that is creating an 8 character code (alphanumeric). I am looking for a good way to do a find and replace of a specific character (the letter O) in the 8 character code.

Reading through the Micros SIM help files, it looks like I may be able to use the Mid function to find the location of the desired character (O) to replace and then make the change based on the position. Would this be the best way to do it or can anyone suggest a simpler method? This would probably be fine if there was only one instance of the character I wish to replace but it becomes complicated if I have to loop through the 8 character code multiple times searching for all instances of the character I want to replace.

Any example code would be apperciated.
 
Dear All
I need help in Micros 3700
I have installed Ws5A as a standalone server(Ovation), I am able to install all the drivers for IDN touch screen
only magnetic card reader is not working
Can any body have idea or driver for magnetic card reader
I have installed windows XP and using this machine with Micros 3700 Ver4.9

Thanks in advance

 
This looks like std basic language from what I was able to search. A simple for next statement and a mid string search should work. I'll step back to the 80's in a bit and post some code that might work.

Cheers,
Coorsman
 
Thanks Coorsman, any example you may have would be very helpful. I think I have the concept but it would be great to see an example.
 


X$="abcabcabcabcabc"

FOR I = 1 to LEN(X$)
IF MID$(X$,I,1)="b" then Y$=Y$ + "E" ELSE Y$=Y$+MID$(,I,1)
NEXT


I know nothing about Micros but the forum search I did on your SIM pointed me in the direction of the old BASIC programming language. Aboove is a code exaple that might work for you.


The way this works,
X$ will be the variable you need to parse.I just filled it with some data abc.
the first statement FOR will start a counting loop and will increase the counter I starting at 1 and end at the total lenght "LEN" of variable X$ - which in this case is 15.

the IF statement compares the middle MID of X$, I spaces in, and one space in length. the then statement if the first statement = true then adds the final variable Y$ to itself Y+Y then adds E replacing the letter b. the else statement just copies Y to itself and adds the remainder variable.

results are in our case
X$ = abcabcabcabcabc
Y$ = aEcaEcaECaEcaEc




Cheers,
Coorsman
 

SIM syntax is similar to basic, but there are some odd differences. Try something like this:

Code:
event inq: 999
	var i		:n1		// counter
	var strOut	:a8 = ""	// output string
	var strIn	:a8		// input string
	var strCur	:a1		// character to check
	
	// assign the input string
	strIn = "jObsjobs"	
	
	// loop through the 8 characters
	for i = 1 to 8
	
		// check each character
		strCur = mid(strIn, i, 1)
		
		// if the current character is "O" append "*" to 
		// the output, otherwise just append the character
		if strCur = "O"
			format strOut as strOut, "*"
		else
			format strOut as strOut, strCur			
		endif
	endfor
	
	// do something with the output string
	waitforclear strOut
	
endevent

Pat
 
Big thanks to the replies to this thread. I greatly appreciate the help and examples.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top