Domanda

I have a list of objects that are returned as a sequence, I would like to retrieve the keys of each object so as to be able to display the object correctly. At the moment I try data?first?keys which seems to get something like the queries that return the objects (Not sure how to explain that last sentence either but img below shows what I'm trying to explain). enter image description here

The objects amount of objects returned are correct (7) but displaying the keys for each object is my aim. The macro that attempts this is here (from the apache ofbiz development book chapter 8).

È stato utile?

Soluzione

Seems like it my sequence is a list of hashes and as explained by Daniel Dekany this post:

The original problem is that, someHash[key] expects a string as key. Because, the hash type of FTL, by definition, maps string keys to arbitrary values. It's not the same as Java's Map. (Note that to further complicate the matters, in FTL someSequenceOrString[index] expects an integer index. So, the [] thing is used for that too.) Now someBeanWrappedMap(key) has technically nothing to do with all the []-s, it's just a method call, so it accepts all kind of keys. If you have a Map with non-string keys, you must use that.

Thanks D Dekany if you're on stack, this ended my half day frustration with the ftl template.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top