Create a Control panel (display only) from which they can run their query.
Give them a field to specify their query in. Give them a field to specify the number of results. I believe the macro could do all of the first two steps, and have their macro do a submit, pushing these values to those fields. Create a hidden table field. Populate the table field with the results of their query on submit. Next, you want to populate the table field, sorting it so you get the most recent tickets at the top. Use an active link guide to table loop through the table until you reach the n'th ticket, incrementing a counter each time the AL Guide looped. Once you hit the n'th ticket, capture that record id, grab the query the original user put in the query bar, append AND 'Request ID' >= $Nth_Record$, then do a window-open of the original schema, and populate with that query, and close the Control panel. It's a lot of work, but I think it would work and would be the most dynamic solution, and suffice with the original request of using a macro. However, I didn't try the above, so you might run into some weird issue (very likely). Additionally, this might be off by like 1 or 2 tickets if a ticket is submitted between the time the table field is populated and the time the window is opened. This would cause you to display extra tickets, so like 51 instead of 50, it just depends a lot on the load of your system. _____ From: Action Request System discussion list(ARSList) [mailto:[EMAIL PROTECTED] On Behalf Of Joe DeSouza Sent: Thursday, January 18, 2007 12:40 PM To: arslist@ARSLIST.ORG Subject: Re: ticket query That might not really get the exact number of N tickets... What I would do is use the EXTERNAL keyword and use a field containing a qualification for the last n ticket say ztmpLastNTickets in a character display only field with ID 1005.. Another field ztmpNEXTID can be set from a Direct SQL Select nextid from arschema where name = "'$SCHEMA$'"; Hold the value for N in ztmpN. Set Field ztmpN = ($ztmpNEXTID$ - $ztmpN$ - 1) Set the field ztmpLastNTickets with 'Request ID' >= "$ztmpN" Use this result in the EXTERNAL keyword on 1005.. It should get what you want... The result will differ however if some rows were deleted in between... Hope this helps and my explanation isn't as cloudy as the sky out here in Virginia.... Joe D'Souza Remedy Developer / Consultant, BearingPoint, Virginia. ----- Original Message ---- From: Roney Samuel <[EMAIL PROTECTED]> To: arslist@ARSLIST.ORG Sent: Thursday, January 18, 2007 1:13:02 PM Subject: Re: ticket query ** Dear Richard, You can achieve this on the user client if you want to do this process manually, You can go to Tools--->Options ---->Behaviours---->Limit Number of Items returned. Set this Field with the number of records you would like the search to return now you can create a simple macro to search on the create date field to get the appropriate number of last N tickets. Hope this helps. Another way is to create a .bat file which would take the Variable N as a parameter and set the SchemasToRemember value for the ar.ini file for the current user. Hope this helps. Regards, Roney Samuel Varghese On 1/12/07, Richard <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Hello, How would I go about querying the last "N" tickets? Meaning, I'd like to create a macro with a variable ("N") to pull up just the last 10, 20, 50, 100 , etc. records recently created. Thanks kindly, Richard _____ No need to miss a message. Get <http://us.rd.yahoo.com/evt=43910/*http:/mobile.yahoo.com/mail%0d%0a> email on-the-go with Yahoo! Mail for Mobile. Get <http://us.rd.yahoo.com/evt=43910/*http:/mobile.yahoo.com/mail%0d%0a> started. __20060125_______________________This posting was submitted with HTML in it___ _______________________________________________________________________________ UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the Answers Are"