cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED]FreeMarker function error.

libman
Champ in-the-making
Champ in-the-making
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.
1 REPLY 1

libman
Champ in-the-making
Champ in-the-making
"Backup" should be "Backups"…