cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Integrity Command Line Timeentries

wstokes
6-Contributor

Integrity Command Line Timeentries

Using the Integrity CLI to extract time entries for analysis and processing.

 

I use something like this;

 

im timeentries --hostname=host --port=port --filter=user:username --filter=entrydata:"between START and END"

(note don't type this in by hand, I have wrapper code written in Python.

I also use mksapiviewer.exe to process the command output as XML and parse it. This all works nicely).

 

The above example extracts the time entries for a user user between the dates START and END. I now have a user case where I would like to extract all time entries recorded against a given Issue ID in a specific time range, regardless of which user entered them.

 

Looking at the help

im timeentries --usage

I see there is a sub-option in the filter section

 

issue=<expression>

However, I am not sure what 'expression' means.

I have tried the obvious approach..

 

im timeentries --hostname=host --port=port --filter=issue:ISSUEID --filter:entrydate:"between START and END"

 

but  I get the following error in my XML:

<Message>MKS124814: Cannot show view information: You must specify an operator for numeric</Message>

It is not obvious to me what the above error is referring to, and what exactly "specify an operator for numeric" means.

 

Any help would be appreciated. 

thanks,

will

 

ACCEPTED SOLUTION

Accepted Solutions
awalsh
17-Peridot
(To:wstokes)

For the issue filter, the expression is a single issue or range of issues. For a single issue, you need to use = before the item ID.  The CLI reference says you should be able to use AND within the filter, but I found that didn't work. 

Instead I used the same method as for si filter options:

"Using commas between the filteroptions serves to build logical "OR" statements between them, allowing you to create powerful filters. You may also specify multiple --filter=filteroptions on the command line, which effectively creates logical "AND" statements between them." 

 

For example: 

D:/private/IntegrityServers/12.0>im timeentries --filter=issue:=652
652     ascea   24-Sep-2018     MKS Integrity   3
652     ascea   23-Sep-2018     MKS Integrity   2
D:/private/IntegrityServers/12.0>im timeentries --filter=issue:"> 1000"
40922   ascea   27-Sep-2018     MKS Integrity   2
40927   ascea   26-Sep-2018     MKS Integrity   12
40784   ascea   25-Sep-2018     MKS Integrity   2
D:/private/IntegrityServers/12.0>im timeentries --filter=issue:"> 1000" --filter=issue:"< 40920"
40784   ascea   25-Sep-2018     MKS Integrity   2
D:/private/IntegrityServers/12.0>im timeentries --filter=issue:"> 1000" --filter=issue:=652
D:/private/IntegrityServers/12.0>im timeentries --filter=issue:"> 1000",issue:=652
40922   ascea   27-Sep-2018     MKS Integrity   2
40927   ascea   26-Sep-2018     MKS Integrity   12
40784   ascea   25-Sep-2018     MKS Integrity   2
652     ascea   24-Sep-2018     MKS Integrity   3
652     ascea   23-Sep-2018     MKS Integrity   2

I hope this helps. 

 

View solution in original post

2 REPLIES 2
awalsh
17-Peridot
(To:wstokes)

For the issue filter, the expression is a single issue or range of issues. For a single issue, you need to use = before the item ID.  The CLI reference says you should be able to use AND within the filter, but I found that didn't work. 

Instead I used the same method as for si filter options:

"Using commas between the filteroptions serves to build logical "OR" statements between them, allowing you to create powerful filters. You may also specify multiple --filter=filteroptions on the command line, which effectively creates logical "AND" statements between them." 

 

For example: 

D:/private/IntegrityServers/12.0>im timeentries --filter=issue:=652
652     ascea   24-Sep-2018     MKS Integrity   3
652     ascea   23-Sep-2018     MKS Integrity   2
D:/private/IntegrityServers/12.0>im timeentries --filter=issue:"> 1000"
40922   ascea   27-Sep-2018     MKS Integrity   2
40927   ascea   26-Sep-2018     MKS Integrity   12
40784   ascea   25-Sep-2018     MKS Integrity   2
D:/private/IntegrityServers/12.0>im timeentries --filter=issue:"> 1000" --filter=issue:"< 40920"
40784   ascea   25-Sep-2018     MKS Integrity   2
D:/private/IntegrityServers/12.0>im timeentries --filter=issue:"> 1000" --filter=issue:=652
D:/private/IntegrityServers/12.0>im timeentries --filter=issue:"> 1000",issue:=652
40922   ascea   27-Sep-2018     MKS Integrity   2
40927   ascea   26-Sep-2018     MKS Integrity   12
40784   ascea   25-Sep-2018     MKS Integrity   2
652     ascea   24-Sep-2018     MKS Integrity   3
652     ascea   23-Sep-2018     MKS Integrity   2

I hope this helps. 

 

wstokes
6-Contributor
(To:awalsh)

OK, so using just the numeric value

filter=issue:123

does not constitute an "expression", whereas;

filter=issue:=123

does. I guess that makes sense, although I have to admit its a little un-intuitive.

 

However the solution works like a charm so many thanks.

 

have a great day

will

 

Announcements


Top Tags