Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_qjlist( <cqueue> [, <ajobid> ] ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_QJLIST( <cQueue> [, <aJobID> ] )


Parameters

<cQueue>
Name of the print queue. The name of the print queue can be prefixed 
with the name of a server:

cQueue = 'FS2\LASER2'

NetLib will remember the argument to <cQueue> specified in the last 
call to one of the N_QJ* functions. You can then pass NIL as the 
argument, and NetLib will assume you mean the same queue as before. 
Thus this sequence is permissible:

N_QJLIST('FS1\PRINTQ_0', aJob)
N_QJSET( , aJob[1], ...)


<aJobID>
Array to receive a list of ID numbers for jobs in the queue.


Returns

Number of jobs in the queue. You can use the return value to size the 
array <aJobID>, and then pass it in a second call to N_QJLIST().

Clipper 5.x  If <aJobID> is initialized to size zero, the function 
will resize it to the the actual number of jobs.


Description

N_QJLIST(<cQueue>, <aJobID>) fills the array with a list of ID numbers 
for jobs in the print queue. The order of the job numbers in the array 
reflects their order in the queue.

Print job numbers can be used as arguments for other print queue 
functions that reorder, delete, set information for, or query 
information about specific print jobs.


Example

/* Let the user select from a menu showing the order of
   each job in the queue, the user who submitted it, a 
   description of the job, the form number, and the job 
   status. Return the job ID of the selection. 
*/
FUNCTION SelectJob( cQueue )
   LOCAL cScreen, nChoice, nJobID
   LOCAL nOrder, cUser, cDescr, nForm, cStatus
   LOCAL aJobs := {}
   LOCAL aMenuItems[N_QLIST(cQueue, aJobs)]
   cScreen = SAVESCREEN(0, 0, MAXROW(), MAXCOL())
   CLS
   @ 3, 10 TO MAXROW(), 68
   @ 1, 10 TO 3, 68 DOUBLE
   @ 2, 12 SAY 'SEQ ' + PADR('User name', 13) + ;
     PADR('Description', 21) + 'Form ' + ;
     PADR('Status', 10)
   // Build menu selection lines
   For nChoice = 1 TO LEN(aMenuItems)
      N_QJGET(cQueue, aJobs[nChoice],  ;
              QJ_CLIENT, @cUser,       ;
              QJ_DESCRIPTION, @cDescr, ;
              QJ_FORMNO, @nForm,       ;
              QJ_ORDER, @nOrder,       ;
              QJ_STATUS, @cStatus)
      DO CASE
      CASE cStatus = 'A' : cStatus = 'Printing'
      CASE cStatus = 'B' : cStatus = 'On hold'
      CASE cStatus = 'D' : cStatus = 'Scheduled'
      CASE cStatus = 'H' : cStatus = 'On hold'
      CASE cStatus = 'R' : cStatus = 'Ready'
      CASE cStatus = 'U' : cStatus = 'On hold'
      OTHERWISE          : cStatus = 'Not ready'
      ENDCASE
      aMenuItems[nChoice] = STR(nOrder, 3) + ' ' +  ;
                            PADR(cUser, 12 + ' ' +  ;
                            PADR(cDescr, 20 + ' ' + ;
                            STR(nForm, 4) + ' ' +   ;
                            PADR(cStatus, 10)
   NEXT
   // Show the menu
   nChoice = ACHOICE(4, 12, MAXROW(), 66, aMenuItems)
   // If a selection was made, get the job ID
   IF nChoice > 0
      nJobID = aJobs[nChoice]
   ENDIF
   RESTSCREEN(0, 0, MAXROW(), MAXCOL(), cScreen)
RETURN nJobID



See Also: N_PSQLIST() N_QJDELETE() N_QJGET() N_QJSET()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson