cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic query in Smartfolder

brijeshnk
Star Contributor
Star Contributor

Hi All,

I  have folllowing usecase

User upload documents in Alfresco with metadata attached  for all the uploaded documents  -  for eg 'Policy number' . 

A user from other group -  Need to query using document with metadata  ( 'Policy number' )  , while querying user input policy number.

To implement this

Can i provide Smart folde with dyanmic query based on user input ? - Is this something which is achievable using smartfolder or what would be the best option to implement such  usecase?

Thanks  a lot

9 REPLIES 9

cesarista
World-Class Innovator
World-Class Innovator

I would say no, smart folders are mostly static saved queries (there is no user input).

It seems that you need some form like advance search form, or even a custom dashlet. For simple searches, for example, based on the policy number field, you can also use Alfresco Full Search Text syntax in search box.

Search in fields | Alfresco Documentation 

Regards.

--C. 

afaust
Legendary Innovator
Legendary Innovator

What you can do with Smart Folders though is have a smart folder template which includes metadata / properties set on the folder node as query parameters. In the smart folder template you can use placeholders for these properties that are then replace at query time with the current property value on the folder. So if your "user input" is that they can change this metadata on the folder to which you have applied the smart folder template, then they can dynamically affect the query of the folder.

brijeshnk
Star Contributor
Star Contributor

Thanks a lot Axel Faust , i think i got the exact solution for the problem. I will goahead and try-out this.

Another query is -   

I assume that , i can dynamically set the meta-data to folder based on user input  , but will be  smart folder will get updated/refreshed automatically  ?  or  Should i execute a script to do that ?

thansk a lot

afaust
Legendary Innovator
Legendary Innovator

When you change the metadata of the folder, the results of the query for the folder contents will change the next time the contents are requested. Depending on how you update the metadata, the UI may still show the contents based on the old data, so you might need to reload / refresh the UI to see the updated results.

brijeshnk
Star Contributor
Star Contributor

Thanks a lot - Will follow this

brijeshnk
Star Contributor
Star Contributor

Hi Axel Faust ,

What would be the right  approach to override advance search option to set metatdata values to a folder ?  I have customised advanced search option to show custom metadata . 

When the user enter the values , i need to set this as part of folder meta-data. 

thanks a lot

afaust
Legendary Innovator
Legendary Innovator

I am not sure I understand this one. Do you already have a different question thread open for this? Why would one want to set the search input for advanced search as metadata on a folder? If the folder matches the input (requirement for even showing up) there should be no need to set the values since they must already be present.

brijeshnk
Star Contributor
Star Contributor

Hi Axel ,  

thanks for the response !

I have customised advance search form to add my custom  meta-data .

Next wat i am trying to do is : -

Set metadata values  selected by user in advanced search form to Smart folder which i have defined . I am trying to achieve this when user click on Search button in advanced form.

User selected values from advanced form will be set  to metadata of Smart-folder  - ( Smart folder then execute query to fetch the list of documents from repo) ,

I am tryint to achive using code  on_click of search button.

I was trying to override the ADVSearch_onSearchClick ,

please let me is this approach is right ?  please let share a link which explain the overriding onSearchClick method .

Where i should add code to overrride ?

thanks a lot

Brijesh

thanks a lot for the respone ,  based on your anser another query poped-up as follows:-

Is it possible to show the metadata as parameter  in search critiera using a dropdown   -  This will helps user to select specific metada from dropdown and enter values to execute search.