I am trying to implement a JIRA report module. For this I am making use of the AbstractReport class which has generateReportHtml() method.
I have the following data that is being passed from java class to vm file:
Map<String, Object> velocityParams = new HashMap<String, Object>();
return descriptor.getHtml("view", velocityParams);
I want to display all the data through vm file
But I am unable to display multiple rows using foreach loop
Thanks in advance
Can you give a snippet of the velocity template code you are using to iterate over the map?
At a guess you probably need to do the foreach loop on the map's entrySet. Something like:
#foreach ($mapEntry in $velocityParams.entrySet()) <tr>
If this doesn't help or you don't get a better answer on here, consider posting your question in Atlassian's dedicated developer community: https://developer.atlassian.com/community/
That's the better place for dev related questions like this.
Edit: Fixed URL.
So you have a collection of issues from somwhere that you are want to loop over?
There are examples in this tutorial showing use of a for each loop in the vm template: https://developer.atlassian.com/jiradev/jira-platform/guides/projects/tutorial-creating-a-jira-report
For example, you can find this snippet in the tutorial:
#foreach ($issue in $issues) <tr> <td width="5%"> </td> #issueLineItem ($issue) <td nowrap> #if($issue.getAssignee()) $issue.getAssignee().getDisplayName() #else $i18n.getText('common.concepts.unassigned') #end</td> <td nowrap>$outlookDate.format($issue.getUpdated())</td> </tr>
But for this to work you need to have got a collection of issues to do the foreach on from somewhere.
I don't see you doing that anywhere in the code you have posted.
Perhaps it will help if you study the code in the tutorial to see where it comes from in that example.
Hi Prashant - can you give more information so that someone in the community may help you? We're users just like you, so it is difficult to help without more details.
When you say 'not working', what is not working? Code won't compile? Run-time error? Not displaying what you expect?
What error messages you are seeing?
If no error message, please give some more details about what you are trying to display. What are you expecting to see? What do you actually see?
I would also recommend you try asking for help on the dedicated developer's community. It is much better suited to questions like this: https://developer.atlassian.com/community/
Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs