Hello,
I have the following code for returning Stories having checkbox set to true. I only have 10 issues with such condition.Could enybody tell me how to return the first, second ..(each row as separate result) row from this query?
Is there any method that I could use for this i.e query.getRow(1), query.getRow(2) ?
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser) def searchProvider = ComponentAccessor.getComponent(SearchProvider) def issueManager = ComponentAccessor.getIssueManager() def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def query = jqlQueryParser.parseQuery("project = currentProject() AND issuetype = 'Story' AND Active='Yes' ")
Thanks in advance
You're just parsing the query there, not actually executing a search. You can get the nth issue like so:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.search.SearchProvider import com.atlassian.jira.jql.parser.JqlQueryParser import com.atlassian.jira.web.bean.PagerFilter def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser) def searchProvider = ComponentAccessor.getComponent(SearchProvider) def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def query = jqlQueryParser.parseQuery("project = currentProject() AND issuetype = 'Story' AND Active='Yes' ") def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter()) results.issues.get(0) // first results.issues.get(1) // second
Probably wise to check results.total though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.