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

Loadkybdmacro Micros3700 Max Macro Keys Error 1

Status
Not open for further replies.

JCCR

IS-IT--Management
Mar 20, 2016
71
CO
Hello everybody,

I know the limit of defined macro keys in a PMS Script is 100, but I'm trying to do the void of products massively in our events and Script that I developed for this returns me the error macro keys Max. ¿I can then reset the counter of defined macro keys somehow ?, this script is written for Micros 3700. Thank you.
 
If you make your routine an inquiry number, you can loop through by basically pushing the inquiry button.

Lets say for example you wrote a script that loops through and prints all of the open checks in a system:

Code:
event inq:1
	Call LoadSQL

	var sql_cmd : A2000

	var OpenChecks : N4
	format sql_cmd as 		"SELECT COUNT( chk_num ) ", 		"FROM micros.chk_dtl ", 		"WHERE chk_open = 'T'"
	Call sql_query( sql_cmd )
	OpenChecks = sql_cmd

	format sql_cmd as 		"SELECT chk_num ", 		"FROM micros.chk_dtl ", 		"WHERE chk_open = 'T'"
	Call sql_recordset( sql_cmd )

	var i : N4
	for i = 1 to OpenChecks
		DLLCALL_CDECL sql_h, sqlGetNext( ref sql_cmd )
		loadkybdmacro key(1, 327684), makekeys( sql_cmd ), @KEY_ENTER, @KEY_ENTER, key(9, print_tender)
	endfor

endevent

Works great, in theory. But if you have too many open checks, you'll end up hitting the max macro keys glitch. The reason appears to be that when calling the loadkybdmacro, it basically just queues up the keys, and doesn't actually run it until the inquiry finishes.

So, instead of doing it that way, something like this would be more reliable:

Code:
retainglobalvar
var OpenChecks : N4
var sql_cmd : A2000
var print_tender : N4  = 506

//do not change
var sql_h : N12 = 0

event inq:1
	Call LoadSQL

	var OpenChecks : N4
	format sql_cmd as 		"SELECT COUNT( chk_num ) ", 		"FROM micros.chk_dtl ", 		"WHERE chk_open = 'T'"
	Call sql_query( sql_cmd )
	OpenChecks = sql_cmd

	format sql_cmd as 		"SELECT chk_num ", 		"FROM micros.chk_dtl ", 		"WHERE chk_open = 'T'"
	Call sql_recordset( sql_cmd )

	loadkybdmacro key(24, 16384 * 2 + @PMSSEQNUM)
endevent

event inq:2
	if OpenChecks > 0
		DLLCALL_CDECL sql_h, sqlGetNext( ref sql_cmd )
		loadkybdmacro key(1, 327684), makekeys( sql_cmd ), @KEY_ENTEr, @KEY_ENTER, key(9, print_tender), key(24, 16384 * 2 + @PMSSEQNUM)
	endif
endevent

Basically, move the logic of your loop into a stand-alone inquiry and do one per inquiry. That way, it will only queue up one loops worth of macro keys, and just trigger the inquiry again once it runs the macro. Make sense?
 
Sorry, you will need another line in that if statement to decrement OpenChecks:

OpenChecks = OpenChecks - 1


But obviously this is just a quick example :)
 
Moregelen Thank you very much. It is a very successful solution. I'll try and fed back the result.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top