Bought the book (Apache Ofbiz Development) and going through chapter 8.
When attempting to retrieve the data via the beanshell script: "data =
delegator.findAll(<entity_name>)"
The ftl generates an error: " Expecting a string, date or number here,
Expression record[key]!"" is instead a freemarker.ext.beans.SimpleMethodModel
The problematic instruction: ---------- ==> ${record[key]!""} "
The following is the macro from the book:
<#macro displayData data>
<#if data?is_sequence>
<#assign keys = data?first?keys/>
<#else>
<#assign keys = data?keys/>
</#if>
<#-- Header -->
<tr>
<#list keys as key>
<td class="dark-grid"><b>${key}</b></td>
</#list>
</tr>
<#-- Data -->
<#if data?is_sequence>
<#list data as record>
<tr>
<#list keys as key>
<td class="light-grid">${record[key]!""}</td>
</#list>
</tr>
</#list>
<#else>
<tr>
<#list keys as key>
<td class="light-grid">${data[key]!""}</td>
</#list>
 <h1>Processed script: "${parameters.scriptName}"</h1>
<#if data?has_content && (data?is_sequence || data?is_hash)>
</tr> </#if>
</#if>
</#macro>
On the off chance that there might be a problem elsewhere, I removed the
section for displaying data and I noticed that the header were composed of the
sql statements the delegator
uses to retrieve the entities. I am very new to ofbiz and aware there's a lot
of ground to cover, however this book is several years old and I'd like to know
if there's an easier/alternate way to
retrieve the data. I should mention that I use groovy wherever possible in my
tests as the book suggests that this is the new scripting method to replace bsh
(learning groovy at the same
time also).
I am working with opentaps 1.5 which I believe ships with ofbiz 10.x
Thanks