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)
How to use iwquerytasks CLT
fallinj
Can anyone provide an example of how to use the command line tool iwquerytasks. I want to query on all active tasks but cannot figure out how to write the XML to do what I want, or do anything at all.
Find more posts tagged with
Comments
Migrateduser
Here's an answer to someone else's post about this.
Here's an email response I sent to someone asking about something similar for the iwquerytasks CLT. You can incorporate the same technique for iwqueryjobs.
There is a way to use the CLT iwquerytasks that you can use from within a script without using STDIN. It's a little funky to use, but here's one way to do it. I tend to be impatient, so once I find a way to get something to work, I don't try to
find the most efficient way, so there may be an easier way. That's my disclaimer. The command reads an XML formatted request, which I read in from a file instead of STDIN. Here's an example.
I do this programmatically because it's part of a custom menu item that allows people to look at their open tasks. I build the XML dynamically, because you never know who the user will be. Here's the perl code to do this:
my $tasks_infile = '/interwoven/iw-home/httpd/iw-bin/iwquerytasks.input';
open OUTFILE, ">$tasks_infile";
print OUTFILE <<END;
<taskquery>
<and>
<ownedby v="$user"/>
<active/>
</and>
</taskquery>
END
close OUTFILE;
# Get the active tasks for this user
my
@active_tasks
= `/interwoven/iw-home/bin/iwquerytasks < $tasks_infile`;
The resulting $tasks_infile looks like this, assuming the user ID is "dsmith":
<taskquery>
<and>
<ownedby v="dsmith"/>
<active/>
</and>
</taskquery>
What gets returned is a list of task IDs that are active for that user. You can take a look at the CLT manual for iwquerytasks for all DTD of the input format. Although it isn't documented very well with lots of examples, all you need to know is there. There's also a similar CLT called iwqueryjobs which does the same thing for jobs.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
sara
I don't receive any output in the array. If I use the CLT on the command line using the file generated in the script I receive the error message: No element found at line 1.
The generated file looks like:
<wfquery><ownedby v=g61160/></wfquery>
What is going wrong?
Sara
Adam Stoller
I cannot test this right now - but try putting quotes around the attribute value:
<wfquery><ownedby v="g61660"/></wfquery>
XML requires that all attribute values be enclosed within quotes (single or double)
--fish
(Interwoven Senior Technical Consultant)
sara
this works, thanks!
sara