Handling of optional data tree
tim <[email protected]> Wed, 11 Feb 2015 07:49:04 -0800 (PST)
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have a data model of this kind:
contract
+contractParties
+contractParty
++share
+++amount
+++currency
...
I want to display amount and share for each contract party:
<#list contract[0].contractParties.contractParty as p>
Amount: ${p.share.amount!}
Share: ${p.share.currency!}
</#list>
list creates a sequence and that's fine. If there is no contract party, this
will just be omitted -> fine.
But then I want to access amount anf currency of the share. This works if
there is a share. It does not work if there is no share, though. If share is
null/empty/missing, it creates an error no matter what I do. I tried
${p.share[0].currency!} and ${p.share[0]!.currency!}, but it does not work
if share is undefined.
Is it possible to either
- turn off error handling for missing data model fractions or
- ignore missing paths
?
Thanks for your feedback!
--
View this message in context: http://freemarker.624813.n4.nabble.com/Handling-of-optional-data-tree-tp4655366.html
Sent from the freemarker-user mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/