Can I set up searches using variable parameters?

I have a database of content that spans a dozen or more topics. I would like to initiate this search pattern (where [ ] is the span of the input terms):

All True

  • All matches [ Study Guide ]
  • Kind is PDF/PS
  • Any True
    – ALL matches [ $TOPIC ]
    – Content matchs [ $TOPIC ]

The variable $TOPIC changes.

Can I do this search over a dozen times without having to duplicate the search over a dozen times, open the search criteria (over a dozen times), and change the two lines?

Ideally I would hope to have a $TOPIC variable (and equivalent) that might be defined for a Group as a parameter that is passed to all searches in the group. I would change that in one location. Ideally, I would like this …

All True

  • All matches [ $TITLEPHRASE ]
  • Kind is PDF/PS
  • Any True
    – ALL matches [ $TOPIC ]
    – Content matchs [ $TOPIC ]

This way, I can set up a generic search template that is duplicated and directly adapted as needed at a higher meta-level, e.g. for $TITLEPHRASE = Homework + $TOPIC = “oxidation reactions”.

The best that I can find is a post from 2013 on what seems to be a comparable request.

I will appreciate insights to higher level approaches. One caveat though. I am keen to avoid an approach that carries over such things as labels or keywords to “corrupt” my other databases. I have no need for example to worry about Homework and oxidation reactions in my database for my citation collections.


JJW

I don’t think you can do this straight off; looking through the DEVONagent manual, I don’t even think variables are offered there, either (DA can search DT, so it would have been a nice solution). I think searches are scriptable though - this thread suggests as much, anyway. So I guess you could script a generic search, which asks you for the variable (or deducts them) and run that from a button. @pete31 might be able to provide more helpful insight.

I cannot also seem to find a way to make this happen by doing container-in-container approaches:

  • Group: Oxidation Reactions
    – All Content Search
    –> All matches “oxidation reactions”
    – PDF Study Guide Search (contained with the Group: Oxidation Reactions)
    — Search only in THIS GROUP
    —> Kind is PDF/PS
    —> Title matches “Study Guide”

This way at least, I would only need to duplicate the Group and change the All Content Search criteria to match $TOPIC that I desire.


JJW

Do you want to do toolbar searches or do you want to create Smart Groups?

I want to generate a STATIC table of contents in the database akin to this …

DATABASE

Topic: Oxidation Reactions (search on term “oxidation reactions”)

  • Study Guides (PDF + LaTeX sources with “Study Guide” as title/content)
  • Homework (PDF + … )
  • Lecture Notes (tbd)
  • Demos (Igor Pro + Maple + … files)

Topic: Mechanical Properties

  • Study Guides
  • Homework
  • Lecture Notes
  • Demos

I am trying to cull and organize (or organize and cull) disparate content from a span of a few decades with the intent to improve the coherence of my presentations.

I also have new content that I am generating that I want to import to the database and have land in “the right place”.


JJW

Sorry, it’s still unclear what the outcome should be.

Here you’re saying it’s a TOC (which format btw? Markdown?) …

… but here you were talking about a search …

… and the linked thread is about Smart Groups

It should be possible to do it in any case, however I don’t know what should be done :slight_smile:

Interesting request.

I can certainly see the utility of this. But I do not think that even Houdaspot or Foxtrot Pro Professional can do this.

My suggestion would be to use the Advanced Search feature of DT3 to get the exact syntax correct as a boolean search with the parameters you want. Then set up a Keyboard Maestro macro which asks for the Topic and then places the search topic in the desired location.

Perhaps even easier than Keyboard Maestro would be a “Fill-In Snippet” using Textexpander - again this could be used to fill in an Advanced boolean search in DT3:

Both the search and the creation of local smart groups can also be scripted.

1 Like

@DrJJWMac I’ve reread the thread again, unfortunately I still don’t get what exactly the TOC should include.

Could you please copy an actual example query from the toolbar search field and post this plus a capture of a TOC record that you’ve build from this example query?

It’s probably possible to script what you have in mind, however I won’t try that without understanding what the output should look like.

Here is an example search.

And here is the database with the example of two out of two dozen or more folders that I want to build.

Not to worry about scripting. I will at this point simply do the brute force method. I can script , but that effort is too time consuming for my tastes. And sometimes, I may have to tweak the internal search details, which is easier to do with a dialog box than in a script.

Foxtrot Pro cannot. Houdaspot seems also not to be able to do this.

I’ll leave with this as a feature request:

  • Allow users to specify $VARIABLE parameters to the text search input fields in one way or another. This opens the door to build templates that can be duplicated and visually changed without scripting or extensive brute-force manipulations.

  • Allow container-in-container searches. What I want to do would be as easily done when I could set up a top-level search on “phases”, collect the content in a folder / smart folder, and then search inside only that folder for Study Guides, Problems, and Homework documents.


JJW

Thanks. Ok, I got it now that you want to create Smart Groups (I was under the impression that you wanted to write names or links of search results into a TOC, e.g. a Markdown TOC record, thus the confusion).

Take a look at Script: Create or change smart group(s). This script asks for a query and creates a Smart Group in all selected groups. If you modify it a bit and e.g.

  • store your variable in the finder comments or custom meta data of selected groups
  • set the dialog’s default answer to your “default” query (the part that’s static)

then it could be possible to get quite near to what you have in mind, I think.

Personally I use a version of this script where the dialog has an extra button “Templates”. Clicking this opens a “choose from list” dialog with template queries (which are stored in a text file that can be opened from within that dialog). That could make sense for you too.

Thank you for the pointer. I see what the script is doing. Should I ever use it, I’ll report back.


JJW