AnsweredAssumed Answered

[SOLVED]FreeMarker function error.

Question asked by libman on Dec 5, 2008
Latest reply on Dec 8, 2008 by libman
Hi,

I am working on a FreeMarker function. It will get the name of the file which is under "Company Home/Backup". There will only be one Backup space name.

My function:
<#function getBackupDirNameobject>
<#if object.parent?exists>
  <#if object.parent.name=="Backup">
   <#return object.name>
  <#else>
   <#return getBackupDirName(object.parent)>
  </#if>
<#else>
  <#return object.name>
</#if>
</#function>
My problem is that it returns a noderef and not the name (so I have no error or warning by console). When executing the following, I get an error:
<#assign x = getClientName(object)>
${x.name}
Expected hash. x evaluated instead to freemarker.template.SimpleScalar on line ..
Where in the corresponding line I ask ${x.name}.It is right that I get an error, but how can I otherwise show the property name (if I didn't program the function wrong)?
I have a loop of objects, where each as "object" and I am able to succesfully show the name of the objects (cm:content) with ${object.name}.

Thanks by advance.

Outcomes