How to put relative path on Smart Folders query?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2017 06:34 AM
Hi,
I have following structure of physical and smart folder:
Directory-One
+-Subdir-1
|
+-Subdir-2
|
+-MySmartFolder <--- smart folder directory
On my smart folder search query path, how to define the 'relative path' instead of absolute path (e.g. PATH:'/app:company_home/st:sites/cm:finance-site/cm:documentLibrary/cm:report-1/*') ?
The path I want to search is under directory "Directory-One" or parent folder, so I will get Subdir-1 and Subdir-2 as well.
The search query will be put on MySmartFolder directory (smart folder template).
Secondly, I need this approach since I want to create a custom smart folder applied into "space template". So, when I create a "folder from template" -- this new physical folder will have a custom smart folder which contains a relative path to its current location/path.
I've tried with . (prompt) sign, self, self::node() to PATH parameters were failed.
How to solve this problem?
Thank you,
[bayu]
- Labels:
-
Alfresco Content Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2017 10:05 AM
There is no such thing as a relative path for the Alfresco FTS query syntax which is used to define the query for virtual folders. You always have to use a path starting from the root.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2017 10:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2017 10:55 AM
If you need dynamic smart folders you may have to implement a script / behaviour to dynamically create the query template based on the (parent) folder with the specific aspect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2017 10:59 AM
OK, I will try and update it here.
Thank you so much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2017 10:56 AM
Did You solve this problem, Bayu? I have the same or a similar one: I have a folder "A" with a type based smart folder "B" in it. I want the smart folder query to show only the results from the folder "A" where the smart folder "B" is in. How can I achieve that?
Axel Faust said, implement a script. But where has the script to reside and when is it supposed to be executed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2017 12:31 AM
Hi Peter,
My question is come when I want to implement it as a template folder (Repository > Data Dictionary > Space Templates), hence when the folder created it will have a relative query to its parent. But as Axel said it couldn't do this approach since smart folder doesn't support relative path. I thought you can still query with absolute path.
Actually I drop this requirement (space templates approach) and create a Javascript based behavior solution as explained in Jeff Potts' blog:
Implementing Custom Behaviors in Alfresco | ECMArchitect | Alfresco Developer Tutorials
Hope it helps.
Thank you,
[bayu]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2017 12:22 PM
Hey,
I found a solution, at least for my use case:
I added to my query:
... and (=PARENT:'<sys:store-protocol>://<sys:store-identifier>/<sys:node-uuid>' or =PRIMARYPARENT:'<sys:store-protocol>://<sys:store-identifier>/<sys:node-uuid>')
This way I limit my search on items, who's Parent or Primary Parent NodeRef is equal to the NodeRef of the physical parent folder of my current smart folder location.