Copy Saved Searches from a Project to another with relative path changes

I've found that aaApi_SQueryCopyByProject will copy Saved Searches from one Project to another Project.  This works but doesn't do exactly what I would like.  I was hoping there was an option for the copy to change the search parameters based upon where I copied the Saved Search to.

Example:

I have a Global Saved Search that wants to find all .dgn files in a Project called "Project A".

So in Builder I would have: Document is in folder 'Project A' or in any subfolder and File name is '*.dgn'  and this Saved Search is saved Globally in Project A.

I then copy the Saved Searches from Project A to Project B.  The rule is still the same.  I was hoping that copying it to a different Project would cause it to change to Document is in folder 'Project B' or in any subfolder and File name is '*.dgn'

Other attempts: I thought that maybe leaving the criteria for the folder off might automatically search only in the project that I was in but it finds files in all projects thus I must specify the folder criteria.  I also looked to see if there was a criteria that would say search in Current Project without having to define who that project is but I didn't find such an option.

Does anyone know of the best way to copy save searches from one Project to another and have the project/folder criteria change accordingly?

Thanks,

Mike

  • Dear Mike,

    I have a function to do this and have used it to re-sync several thousand projects with a template of saved searches - editing them one by one was not an option.

    I have used aaApi_SQueryCopyByProject  and then modified the project id in the new destination search.

    The code was note designed to be that portable but functional I will see if I can get a good chunck to you.

    Best regards,

    Ian Emery

  • I would be extremely appreciative of any example!

    I understand the portable issue as I have code written for very specific ProjectWise hierarchies that wouldn't play in other ProjectWise installations but as you are aware just knowing the correct SDK calls to make and what the parameters should be is invaluable.

    Thank you!

    Mike