WorkunitList

STD.System.Workunit.WorkunitList ( lowwuid [ , highwuid ] [ , username ] [ , cluster ] [ , jobname ] [ , state ] [ , priority ] [ , fileread ] [ , filewritten ] [ , roxiecluster ] [ , eclcontains ] [ , online ] [ , archived ] [ , appvalues ])

lowwuidA null-terminated string containing the lowest WorkUnit IDentifier to list. This may be an empty string.
highwuidOptional. A null-terminated string containing the highest WorkUnit IDentifier to list. If omitted, the default is an empty string.
clusterOptional. A null-terminated string containing the name of the cluster the workunit ran on. If omitted, the default is an empty string.
jobnameOptional. A null-terminated string containing the name of the workunit. This may contain wildcard ( * ? ) characters. If omitted, the default is an empty string.
stateOptional. A null-terminated string containing the state of the workunit. If omitted, the default is an empty string.
priorityOptional. A null-terminated string containing the priority of the workunit. If omitted, the default is an empty string.
filereadOptional. A null-terminated string containing the name of a file read by the workunit. This may contain wildcard ( * ? ) characters. If omitted, the default is an empty string.
filewrittenOptional. A null-terminated string containing the name of a file written by the workunit. This may contain wildcard ( * ? ) characters. If omitted, the default is an empty string.
roxieclusterOptional. A null-terminated string containing the name of the Roxie cluster. If omitted, the default is an empty string.
eclcontainsOptional. A null-terminated string containing text to search for in the workunit's ECL code. This may contain wildcard ( * ? ) characters. If omitted, the default is an empty string.
onlineOptional. A Boolean true/false value specifying whether the search is performed online. If omitted, the default is TRUE.
archivedOptional. A Boolean true/false value specifying whether the search is performed in the archives. If omitted, the default is FALSE.
appvaluesOptional. A null-terminated string containing application values to search for. Use a string of the form appname/key=value or appname/*=value.
Return: WorkunitList returns a DATASET.

The WorkunitList function returns a dataset of all workunits that meet the search criteria specified by the parameters passed to the function. All the parameters are search values and all but the first are omittable, therefore the easiest way to pass a particular single search parameter would be to use the NAMED parameter passing technique.

The resulting DATASET is in this format:

WorkunitRecord := RECORD
  STRING24 wuid;
  STRING owner{MAXLENGTH(64)};
  STRING cluster{MAXLENGTH(64)};
  STRING roxiecluster{MAXLENGTH(64)};
  STRING job{MAXLENGTH(256)};
  STRING10 state;
  STRING7 priority;
  STRING20 created;
  STRING20 modified;
  BOOLEAN online;
  BOOLEAN protected;
END;

Example:

OUTPUT(STD.System.Workunit.WorkunitList(''));
 //list all current workunits
OUTPUT(STD.System.Workunit.WorkunitList('',
       NAMED eclcontains := 'COUNT'));
 //list only those where the ECL code contains the word 'COUNT'
 //this search is case insensitive and does include comments

STD.System.Workunit.SetWorkunitAppValue('MyApp','FirstName','Jim',TRUE);
OUTPUT(STD.System.Workunit.WorkunitList(appvalues := 'MyApp/FirstName='Jim'));
//returns a list of workunits with app values where FirstName='Jim'

See Also: SetWorkunitAppValue