[stringtemplate-interest] Working with filtered list

Grzegorz Danowski gdn at poczta.onet.pl
Mon Jun 25 06:41:03 PDT 2007


Hi,

 

I would like to filter list of customers and simultanously if output list
contains more customers then one I'd like to add sequence number.

 

I have found template that filter data:

 

            StringTemplate template = new StringTemplate("$data:{" +

                "$if(it.IsSmart)$$it.CustomerName$$endif$}$");

 

And have found template that add sequence number if customers number is
greater then one:

 

            StringTemplate template = new StringTemplate(

                "$if(rest(data))$$data:{$i$. $it.CustomerName$}$" +

                "$else$$data.CustomerName$$endif$");

 

But I don't know how connect both functionalities in one tempate.

Regards,

Gregory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20070625/82e08f5b/attachment.html 


More information about the stringtemplate-interest mailing list