Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
iwqueryjobs
System
Does anyone know where the documentation for the iwqueryjobs query syntax is?
I need a (case insensitive) query to return Job ID for all jobs with active tasks owned by a given user - does anyone have one?
Find more posts tagged with
Comments
Migrateduser
This is a weird CLT, as is iwquerytasks. I use iwquerytasks, but iwqueryjobs is pretty similar. It takes some XML as input, which makes it difficult, but not impossible to execute this command on the command line. I find it much easier to use it in a script and store the XML in a file and use the contents of the file as input. So I dynamically build the XML as follows:
my $jobs_infile = '/interwoven/iw-home/httpd/iw-bin/iwqueryjobs.input';
open OUTFILE, ">$jobs_infile";
print OUTFILE <<END;
<wfquery>
<and>
<ownedby v="$user"/>
<active/>
</and>
</wfquery>
END
my
@active_tasks
= `/interwoven/iw-home/bin/iwqueryjobs < $jobs_infile`;
If you want to run the command from the command line, you enter the XML and on the last line I think you end the input by entering a dot or something like that. I don't recall.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
XMLIN_Match.jpg
Migrateduser
Thanks, I'm sorry I didn't post sooner. It turns out that I did need to use a task query (not a jobs query), but I don't think there is enough where clause to do what I needed to do (I couldn't filter out the readonly tasks or the ones that are not in the workarea that the user is in) - so I have to check some properties after I retrieve the task list. I also used OpenAPI for this.
I don't understand why taskID is implemented as a long if int is 32 bits (I didn't know this until I had this issue to resolve, and I had already coded my API with int). This is just one of my many OpenAPI mysteries. Does someone really have a TeamSite system with billions of jobs/tasks?
String strTaskQuery = "<taskquery><and><active /><ownedby v='" + objIWJSPUtil.getUser().getFullLogin() + "' /></and></taskquery>";
IWTask.Selector objTaskSelector = new IWTask.QuerySelector( strTaskQuery );
Collection objTaskCollection = (Collection) IWTask.getAllCollection( objIWJSPUtil.getIWWorkFlowService(), objTaskSelector, IWTask.oNone );
Iterator objTaskIterator = objTaskCollection.iterator();
if ( ! objTaskIterator.hasNext())
{
throw( new CMSException( "No active task(s) owned by " + objIWJSPUtil.getUser().getFullLogin()));
}
boolean boolFoundJobs = false;
while ( objTaskIterator.hasNext())
{
IWTask objIWTask = (IWTask) objTaskIterator.next();
if ( objIWTask.isValid( objIWJSPUtil.getIWWorkFlowService()))
{
long id = objIWTask.getId();
JobTask objJobTask = new JobTask((int) id);
if ( objJobTask.getWorkarea().equals( objWorkarea ) && ! objJobTask.isReadOnly())
{
boolFoundJobs = true;
Migrateduser
you can also try using this from the command line,
echo "<taskquery/>" | iwquerytasks