Re: Iterate a Set of data
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
What ordering are you expecting? The order of the riskSummaryRepors
will be the same as the Set gives them to FreeMarker.
Friday, September 23, 2011, 2:20:42 PM, Geeth Lochana wrote:
> I have collection of data, record as like follows.
> Class RiskSummaryRpt{
> private String name;
> private String value;
> }
>
> Class Report{
> private Set<Abc> riskSummaryRpt;
> }
>
> i want to get following out put using freemarker template
>
> using above collection i want to get single record.
>
> this is the current template i have
> <#list report.riskSummaryRpt as param>
> <#if param.name == 'Factor'>
> <factor>
> <risk>${param.riskVal!""}</risk>
> </factor>
> <#elseif param.name == 'Stock Specific'>
> <specific>
> <risk>${param.riskVal!""}</risk>
> </specific>
> <#elseif param.name == 'Total'>
> <totalVariance>
> <risk>${param.riskVal!""}</risk>
> </totalVariance>
> </#if>
> </#list>
>
> i need to get following output with correct order of tags.
> <factor>
> <risk>12.32</risk>
> </factor>
> <specific>
> <risk>12.32</risk>
> </specific>
> <totalVariance>
> <risk>12.32</risk>
> </totalVariance>
>
>
> but i couldn't get the order is mismatch.
> Any one have any idea to over come this issue.
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2