Skip to content

Ternary operation/conditionals #537

@rkeeling75

Description

@rkeeling75

Is there a way to do a conditional statement? I would like to track a habit and know when the last time I did something was. However, if I haven't done that yet, I would like to be able to see that too.

For example, here is a simple template

searchType: task.notdone, task.done
searchTarget: Walking, Walking
folder: Diary\2026
summary:	
	template: " - Walks this year: {{sum(dataset(1))}}\n -   Last walk (if the above isn't zero, otherwise ignore) {{endDate(dataset(1))}}\n - Worst streak so far: {{maxStreak(dataset(0))}} days."

However, if you haven't completed the task even once in the dateset, then endDate is the current date

It would be nice to have something like a ternary operator so that you can have something like

dataset(1) == 0 ? No walks so far : endDate(dataset(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions