Merci pour votre résponse.
Yes I know that I am supposed to put the entity name there I was just being 
generic.
I solved the problem and posted the issue on stack: 
http://stackoverflow.com/questions/14650949/whats-the-meaning-of-within-a-variable-expression-in-freemarker


On 10 mars 2013, at 11:47, Paul Foxworthy wrote:

> Hi DarkStar,
> 
> Just in case you weren't aware, where you see <entity_name> you should
> substitute the name of the entity you want, such as "Party".
> 
> If you do a view source on the page in the browser, you might find that the
> td with a class of dark-grid was rendered before the error occurred. This
> would give you the value of the key variable.
> 
> The basic approach of using groovy to retrieve some data and populate a
> collection for use by freemarker is common. See for example
> 
> https://fisheye6.atlassian.com/browse/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/ViewProfile.groovy?hb=true
> 
> which is called from
> 
> https://fisheye6.atlassian.com/browse/ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml?hb=true#to67
> 
> Yes, Groovy is replacing beanshell and should be used for anything new.
> 
> Cheers
> 
> Paul Foxworthy
> 
> 
> DarkStar1 wrote
>> 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/>
>> &lt;/#if&gt;
>>  <#-- Header -->
>> 
> 
>>    <#list keys as key>
>> 
> *
>> ${key}
> *
>>    &lt;/#list&gt;
>> 
> 
>>  <#-- Data -->
>>  <#if data?is_sequence>
>>    <#list data as record>
>> 
> 
>>            <#list keys as key>
>> 
> 
>> ${record[key]!""}
> 
>>            &lt;/#list&gt;
>> 
> 
>>    &lt;/#list&gt;
>>  <#else>
>> 
> 
>>          <#list keys as key>
>> 
> 
>> ${data[key]!""}
> 
>>          &lt;/#list&gt;
>>         
> 
>> Processed script: "${parameters.scriptName}"
> 
>>          <#if data?has_content && (data?is_sequence || data?is_hash)>
>> 
> 
>> &lt;/#if&gt;
>>  &lt;/#if&gt;
>> &lt;/#macro&gt;
>> 
>> 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
> 
> 
> 
> 
> 
> -----
> --
> Coherent Software Australia Pty Ltd
> http://www.coherentsoftware.com.au/
> 
> Bonsai ERP, the all-inclusive ERP system
> http://www.bonsaierp.com.au/
> 
> --
> View this message in context: 
> http://ofbiz.135035.n4.nabble.com/Recommended-entity-retrieval-method-tp4639244p4639774.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
> 

Reply via email to