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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

How does the Java API command to run a custom query look like?

sziel
5-Regular Member

How does the Java API command to run a custom query look like?

Hi,

 

I am wondering how the Java API command for this CLI command would look like:

im issues --fields="ID,Summary" --sortField="Planned Release End Date" --queryDefinition=((field[Type]="Release")and(field[State]="Scheduled,In Progress")and(field[Project]="/some_project"))

 

I am stuck with the fields and the query definition option Man Frustrated

 

What I have so far:

Command command = new Command();
command.setApp(Command.IM);
command.setCommandName("issues");
command.addOption(new Option("sortField","Planned Release End Date"));

 

Or is there any way to run the CLI command via the Java API directly without having im.exe and IntegrityClient.exe called?

 

Regards,

Simon

ACCEPTED SOLUTION

Accepted Solutions
uminet
13-Aquamarine
(To:sziel)

Hello,

 

I'm running a --querydefinition in Java like that, e.g.:

List<Option> cmdOptions = new ArrayList<Option>();

cmdOptions.add(new Option("querydefinition", "((field[Project] = \"" + projectName

+ "\") and (field[Type] = RQ1_Input,RQ2_Requirement,RQ3_Design) and (item.content) and (not (field[KBRQ_Qualification Method] is unspecified)))"));

cmdOptions.add(new Option("fields", "ID,KBRQ_Qualification Method"));

 

Hint if you want to figure out the querydefintion: add a custom action to cmd.exe to your Client, define the quick query the way you want, open CMD via custom action and have a look at MKSSI_query environment variable. Hope that helps to get your java running.

View solution in original post

3 REPLIES 3
uminet
13-Aquamarine
(To:sziel)

Hello,

 

I'm running a --querydefinition in Java like that, e.g.:

List<Option> cmdOptions = new ArrayList<Option>();

cmdOptions.add(new Option("querydefinition", "((field[Project] = \"" + projectName

+ "\") and (field[Type] = RQ1_Input,RQ2_Requirement,RQ3_Design) and (item.content) and (not (field[KBRQ_Qualification Method] is unspecified)))"));

cmdOptions.add(new Option("fields", "ID,KBRQ_Qualification Method"));

 

Hint if you want to figure out the querydefintion: add a custom action to cmd.exe to your Client, define the quick query the way you want, open CMD via custom action and have a look at MKSSI_query environment variable. Hope that helps to get your java running.

awalsh
17-Peridot
(To:sziel)

ETA: or what uminet said. I should have refreshed before posting 😉

 

You would add the fields and queryDefinition options the same way as the sortField:

 

cmd.addOption(new Option("queryDefinition", "((field[Type]=Release)and(field[State]=Scheduled,In Progress)and(field[Project]=/some_project))"));
cmd.addOption(new Option("fields", "ID,Summary"));

 

 

 

 

sziel
5-Regular Member
(To:awalsh)

Thanks for the reply.

In fact there was a typo in my command Robot LOL

Your example helped to figure it out.

Announcements


Top Tags