Set Properties for daily note

Hi,
First of all thanks for this great piece of software :slight_smile:
I’m struggling with my shortcut for the end of my day. I need to set two properties (Sport and Reading). The shortcut is working but I don’t think it is best practice how I’ve managed it. So I’m asking via a choose from menu the two questions: Did I Sport Today and Did I read Today? Now I’ve set every “set property for daily note” before every end of menu. So that means that the questions are separately processed and after finishing the first one it will ask me the second question, is it possible to first ask all questions and process them together.

See my shortcut

Thanks Juul

Hi @Juul, welcome to the forum! Sorry for keeping it short, but I’m currently moving houses, and it’s all a bit wild :sweat_smile:

So that means that the questions are separately processed and after finishing the first one it will ask me the second question, is it possible to first ask all questions and process them together.

Yes, it is, you’re on the right track here! By combining the single results in one dictionary and then setting the properties of the DN once you can save quite a bit of back and forth. Here’s how I would go about the whole thing. I’ve added some comments so you’ll get an idea what’s going on:

And here’s the download: End of Day Daily Note.shortcut (22.5 KB)

Let me know if that does it for you :call_me_hand:t3:

2 Likes

This works great. Nice example for Set Properties in notes. Of course, this fails if the note does not exist, so you should use Check Note first to see if it’s available to set properties; if not, then you could Create Note, and follow the if block with Set Properties so it works whether the note exists or not (the if true branch would be empty, and only otherwise has Create Note). Also, I like how the action adds new properties at the end of any existing properties, rather than at the top. Examples like this are really helpful. Thanks.

P.S. You might mention that you use Select Variable to get the right List variable for each property in the Dictionary since that might not be obvious from just the screenshot.

1 Like

Thanks Carlo!

No problem at all. This example is much cleaner and more efficient. Great this really helps :slight_smile:

@doug78645 If the note does not exist this works as well with my daily note, because the template is automatically set.

When I run the shortcut it fails if there is no daily note, so I had to add an the Check Note action and Create Note under Otherwise for the if action, and follow the if block with Set Properties so it will work in either case.

The operation couldn’t be completed. [Not found] Calendar/Notes/2024/12/12/2024-12-12.md

My Templater settings have:

  • Fomat: YYYY/MM/DD/YYYY-MM-DD
  • Daily Note Template: x/Templates/Calendar/Periodic/Note template - Day.md
  • Note Folder: Calendar/Notes

The Create Note action does automatically create a new Daily Note if it doesn’t exist, but that doesn’t seem to be the case for Set Properties when the note hasn’t already been created.

I’m using Actions for Obsidian 2024.2.3 (7402) with Actions URI 1.6.5 (Obsidian community plugin) and Templater 2.9.1.

Could you be using the Core plugin for Daily Notes? I have Daily Notes disabled, and use Templater instead. I thought Actions for Obsidian would work either way for Create Note, but maybe that’s not the case for Set Properties. Perhaps, @czottmann can clarify why that doesn’t work for me, but it does for you.

The Create Note action does automatically create a new Daily Note if it doesn’t exist, but that doesn’t seem to be the case for Set Properties when the note hasn’t already been created.

That’s the intended behavior – Set Note Properties won’t create a note. It’s a convenience option that is only available in actions which update the note body (appending etc.) but not for the frontmatter-related actions. I had to draw the line somewhere. :wink:

2 Likes

Thanks for that confirmation. That’s what discovered when initially trying the example. That’s why I added the Check Note with an if otherwise with Create Note if not already there.

I don’t see how Juul’s works when it doesnt exist, but maybe it was actually already there.

1 Like

@doug78645 I’m sorry you’re wright. I think I’ve tested it without knowing that my daily note already existed. I’ve tried it again today and I’m getting the same error as you.

1 Like

The fix is simple. Add a Create Note action on top with the If periodic note already exists option set to “Leave note as-is”. This will create the note if it doesn’t exist yet but do nothing if it does.

1 Like

That makes sense, and I feel better knowing that you also get the same error. I was trying to figure out why it worked for you when it didn’t for me. I appreciate the follow-up that your daily note already existed.

@czottmann Thanks for mentioning that. You don’t actually need to wrap Create Note within an if otherwise block because you can simply use Create Note (with “Leave note as-is” if periodic note already exists) before the Set Properties action. Much simpler!