rneuber1's avatar
rneuber1
Ideator I
6 years ago

Advanced Search Options - Relative Date searches

This patch makes it possible to use specific parameters in Aras searches that are computed at runtime. For example, there is a parameter @userid which is replaced by the userid of the currently logged-in user each time the search is executed.

This is extremely handy for saved searches, which are shared amongst others: If a search like <created_by_id>@userid</created_by_id> is shared and shown on the TOC, only one SavedSearch item exists in the database, but every user has an individual "Created by me" search available.

Of course, you can use multiple parameters in one query, so event statements like "Between yesterday and tomorrow" are possible:<modified_on condition="between">@today(-1) and @today()</modified_on>

                   

Relative date searches make it possible to have saved searches like

1. New This Week

<created_on condition='ge'>@bow</created_on>   // @bow  aka beginning of week expands to last Monday, 00:00am

2. Due This Month

<due_date condition='le'>@eom</due_date>    // @eom aka end of month expands to first day of next month, 00:00am

3. Locked by myself

<locked_by_id>@userid</locked_by_id>     

Bookmarking the searches allows for quick access to these parameterized queries:

While these parameters work independently of the search mode (Simple, Advanced, AML), most of the time you will use them in AML mode, simply because the user interface does not allow you to enter freetext for date properties, but will show a calendar widget instead.

Interested in this project? Check it out on GitHub!

https://github.com/rneuber1/ArasAdvancedSearches 

Contributors

Rolf Neubersch

License

See project repository for license info

6 Comments

  • Yes, these warnings are really annoying and to my mind not needed at all!

    To get rid of these warnings you have to edit Innovator/Client/javascript/search_container.js:

    Just set bSwitchToNewSearchMode to true and remove/comment the aras.confirm() call in line 584: 

    [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:49c6e09e-50a3-4723-87f8-217851b8b5bc:type=javascript&text=const%20bSwitchToNewSearchMode%20%3D%20true%3B%0D%0A%09%09%2F%2Aaras.confirm%28%0D%0A%09%09%09aras.getResource%28%0D%0A%09%09%09%09%27%27%2C%0D%0A%09%09%09%09%27search_container.aml_is_not_compatible_with_new_search_mode2%27%2C%0D%0A%09%09%09%09curModeLabel%2C%0D%0A%09%09%09%09newModeLabel%0D%0A%09%09%09%29%0D%0A%09%09%29%3B%2A%2F]

  • There is a small Readme and and a more detailed Wiki page with explanations and installation instructions. Does that suffice? If this is ok, please spread the word because I think this is a mighty feature that has been missing way too long.

    \Ralf

  • This is something that annoyed me as well. I found a way to get rid of the warning. While this might potentially have some negative side effects, I did not experience any, so give it a try:

    In Innovator/Client/javascript/search_container.js change line 584ff (for 12SP8 at least):

    from 

    [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:e424bf51-6f83-4e29-9973-58d42cdd62b9:type=csharp&text=const%20bSwitchToNewSearchMode%20%3D%20aras.confirm%28]

    to

    [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:02dadca1-e47f-4c90-8c37-4502636061aa:type=csharp&text=const%20bSwitchToNewSearchMode%20%3D%20true%3B]

    and remove / comment the subsequent aras.confirm() statement completely. This removes the warning (which is not needed at all in my opinion).

    \Ralf 

  • It works very well ! Thanks you.

    Just a question, is it way when you have defined a custom AML saved search to hide the warning dialog when you change the search mode.... and to hide the AML custom search ?

  • Hi Rneuber1,

    I really like this solution! Would you mind updating the Readme file with some installation/usage instructions and screenshots? I think many people would find this useful. Once you've updated the Readme, Labs will help spread the word about it, whether that be through tweets, our github page, or potentially a blog!

    Thanks for your contribution,

    AJ