Nesting "if statement" and "foreach statement"
ken4ward <[email protected]> Wed, 16 Jul 2014 01:44:45 -0700 (PDT)
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
The value in doc.db.persons.personname[0] is thomas. <#global y = doc.db.persons.personname[0]> [#foreach item in doc.db.persons] <#if y != "thomas"> yes, it is ok <#else> no, remove it </#if> [/#foreach] Check the code snippet above, it's definite that something is wrong with it, kindly help me fix it. The problem is that the Freemarker interpreter does not interpret the foreach statement, only the if statement it interprets. When compiled it gives an output thus: Output [#foreach item in doc.db.persons] yes, it is ok [/#foreach] So my question is what better way can I write this code for both statements to be interpreted? Hoping to have your take on this. Thanks. -- View this message in context: http://freemarker.624813.n4.nabble.com/Nesting-if-statement-and-foreach-statement-tp4655207.html Sent from the freemarker-user mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds