Freemarker sort_by
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2008 10:20 AM
Hi everybody,
I have created a custom type of documents and a custom type of folder for containig them.
For showing the documents in a custom view I have created a template.
I need to sort the documents by one of the custom properties but I don't know how to do it.
Reading some posts I have tried with:
<#list space.children?sort_by(["properties","fact:cuenta"]) as child> but it doesn't work.
The error I get is:
Error during processing of the template '?sort_by(…) failed: The "fact:cuenta" subvariable (specified by ?sort_by argument number 2) was not found.'. Please contact your system administrator.
Also i tried with
#list space.children?sort_by(['properties','fact:cuenta']) as child> but I get the same error.
Could anyone help me, please?
Thanks in advance,
Teresa
I have created a custom type of documents and a custom type of folder for containig them.
For showing the documents in a custom view I have created a template.
I need to sort the documents by one of the custom properties but I don't know how to do it.
Reading some posts I have tried with:
<#list space.children?sort_by(["properties","fact:cuenta"]) as child> but it doesn't work.
The error I get is:
Error during processing of the template '?sort_by(…) failed: The "fact:cuenta" subvariable (specified by ?sort_by argument number 2) was not found.'. Please contact your system administrator.
Also i tried with
#list space.children?sort_by(['properties','fact:cuenta']) as child> but I get the same error.
Could anyone help me, please?
Thanks in advance,
Teresa
Labels:
- Labels:
-
Archive
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2008 02:53 AM
Does every child has your custom property?
If you want to sort by freemarker, be sure every child have that property.
friendly regards,
Nick
If you want to sort by freemarker, be sure every child have that property.
friendly regards,
Nick

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2008 02:55 AM
are you 100% certain that each of the children of the space you are looking at has the property "fact:cuenta"?
I just tested with this little script, and it worked fine:
I just tested with this little script, and it worked fine:
<#list companyhome.children?sort_by(["properties", "cm:name"]) as child>
It works
</#list>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2008 04:39 AM
Yes, all the documents of the space have the property.
In fact, the property is mandatory in the custom type, and this custom type is the only one that this custom space accepts.
For giving more details: the possible subspaces in this space wouldn't have the property but at the moment there aren't subspaces.
<#list space.children?sort_by(["properties", "cm:name"]) as child> also works for me but
<#list space.children?sort_by(["properties", "fact:cuenta"]) doesn't.
Could you, please, try with a property of a custom type in your system?
Thanks a lot for helping me,
Teresa
In fact, the property is mandatory in the custom type, and this custom type is the only one that this custom space accepts.
For giving more details: the possible subspaces in this space wouldn't have the property but at the moment there aren't subspaces.
<#list space.children?sort_by(["properties", "cm:name"]) as child> also works for me but
<#list space.children?sort_by(["properties", "fact:cuenta"]) doesn't.
Could you, please, try with a property of a custom type in your system?
Thanks a lot for helping me,
Teresa

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2008 04:46 AM
It should work. I already used this sort option may times with custom properties.
Did you declare "fact" as prefix for your namespace?
You could try to take the whole name space name.
e.g.: <#list space.children?sort_by(["properties", "aaa.bbb.fact:cuenta"])
Friendly regards,
Nick
Did you declare "fact" as prefix for your namespace?
You could try to take the whole name space name.
e.g.: <#list space.children?sort_by(["properties", "aaa.bbb.fact:cuenta"])
Friendly regards,
Nick
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2008 07:57 AM
Thanks again for your help.
I've checked everything and it seems to be ok and completely declared ( prefix and so on).
This is very curious:
If I try to use <#list space.children?sort_by(["properties","fact:cuenta"]) as child> in a STANDARD space it WORKS.
But I need some special properties also for the space that contains the documents, so I have a standard space with some aspects added.
These aspects are really simple and they are declared in the same custom model: fact model.
I include them in order to show their simplicity:
<aspect name="fact:factid">
<title>contador espacio</title>
<properties>
<property name="fact:folderid">
<type>d:int</type>
</property>
</properties>
</aspect>
<aspect name="fact:factacum">
<title>acumulado</title>
<properties>
<property name="fact:acumulado">
<type>d:float</type>
</property>
</properties>
</aspect>
<aspect name="fact:aspclienteid">
<title>cliente asociado</title>
<properties>
<property name="fact
aspclienteid">
<type>d:text</type>
</property>
</properties>
</aspect>
<aspect name="fact:aspdocpres">
<title>documentos presentes</title>
<properties>
<property name="fact
aspdocpres">
<type>d:int</type>
</property>
</properties>
</aspect>
Once I have done it, the exactly same <#list space.children?sort_by(["properties","fact:cuenta"]) as child> DOESN'T WORK in the "aspected" space.
Any idea?,
Thanks again, Nick
Teresa
I've checked everything and it seems to be ok and completely declared ( prefix and so on).
This is very curious:
If I try to use <#list space.children?sort_by(["properties","fact:cuenta"]) as child> in a STANDARD space it WORKS.
But I need some special properties also for the space that contains the documents, so I have a standard space with some aspects added.
These aspects are really simple and they are declared in the same custom model: fact model.
I include them in order to show their simplicity:
<aspect name="fact:factid">
<title>contador espacio</title>
<properties>
<property name="fact:folderid">
<type>d:int</type>
</property>
</properties>
</aspect>
<aspect name="fact:factacum">
<title>acumulado</title>
<properties>
<property name="fact:acumulado">
<type>d:float</type>
</property>
</properties>
</aspect>
<aspect name="fact:aspclienteid">
<title>cliente asociado</title>
<properties>
<property name="fact

<type>d:text</type>
</property>
</properties>
</aspect>
<aspect name="fact:aspdocpres">
<title>documentos presentes</title>
<properties>
<property name="fact

<type>d:int</type>
</property>
</properties>
</aspect>
Once I have done it, the exactly same <#list space.children?sort_by(["properties","fact:cuenta"]) as child> DOESN'T WORK in the "aspected" space.
Any idea?,
Thanks again, Nick
Teresa
