How to toggle / cycle through field values

Things I have tried

Searching this forum for similar questions and answers

What I’m trying to do

I’d like to know how to cycle through a set of preset values for a particular field. I understand that this might not be possible natively in Obsidian, so willing to use a macro from Keyboard Maestro to assist.

For example I have the following field in my file:

status:: now

On pressing a hotkey I’d like the status to change to the next status in it’s sequence e.g. next. A sample sequence would look like the following (and would loop)

I have some very basic programming knowledge so my 1st thought was to create a python script to parse the whole file that I’m in, look for the field, look for the value and then cycle to the next one. I’d do all of this outside of Obsidian

The next idea was to somehow access the filed via Obsidian itself? Maybe it’s API? Not exactly sure on where to start on this one.

An alternative solution would be to have autocomplete / suggestion for that field. i.e a list of statuses appear when clicking in that field.

Thanks in advance!

Are you looking for something like this:

Page down to the sections on selecting fields.

1 Like

If u want to go the autocomple route, perhaps Completr or Autocomplete.

That said, i suggest consider nested tags for your statuses like #status/next. There’s few benefits doing so

  • it’s natively supported (no need community plugin)
  • it has autocomple built-in. Not the level of cycle thru but if u delete until #status/ u r presented shortlisted tags (instead of all available tags)
  • u can click on the tag pane to list/search
  • if u use Dataview plugin (or Tag Wrangler or Tagfolder), you can work with nested tags as well with these plugins (to enhance experience for item #2 & #3 above)

This looks awesome. Thanks so much. I’ll take a look at it in more detail in the morning

1 Like

took a look and it’s pretty cool in principal - just needs a keyboard shortcut for cycling values.

Thanks and an interesting suggestion!

would any one know how to access the metadata of an open note programmatically?

i replied suggesting dataview, but i believe u already aware of that. what do u mean by access the metadata programmatically? dataview isn’t enough?

I meant for writing a small script to manipulate a note. So not a full blown plugin, but perhaps using the API to make a change to the current document - just thinking out aloud

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.