obsidian-tracker icon indicating copy to clipboard operation
obsidian-tracker copied to clipboard

invert the logic to track

Open jarpolacek opened this issue 1 year ago • 4 comments

I have data that is a Boolean value of 1 and 0. By default, I use the calendar view based on the "month:" command and it will display the days, with a value of 1. Can I invert the logic to display 0? I tried showSelectedValue: false, but that had no effect...

jarpolacek avatar Oct 29 '23 12:10 jarpolacek

Depending on how long you have been tracking, it might be easier to invert what you have been tracking instead.

lazyguru avatar Oct 29 '23 22:10 lazyguru

Seconding this. I'm just getting started setting up my Obsidian habit tracker and would love to see my streaks for avoiding bad habits

garbofrogman avatar Dec 30 '23 00:12 garbofrogman

@jarpolacek In case you're interested, here's a workaround I came up with using Dataview.

```dataview
CALENDAR date(file.name, "dd-MM-yyyy")
FROM "Daily"
WHERE !badHabit AND !veryBadHabit

This is tailored to my specific notes but just to give you an idea. This takes notes which have the date as their title and fixes the formatting. The notes are stored in the "Daily" folder The calendar is marked as long as the bad habits have a value of null or 0

garbofrogman avatar Dec 30 '23 02:12 garbofrogman

I think I figured it out

searchType: frontmatter
searchTarget: Bad Habit
folder: Folder/Folder
datasetName: No Bad Thing!
valueShift: -1
penalty: 1
month:

" valueShift: -1 penalty: 1 "

valueshifts the "i did the bad thing" true(1) down to 0, and then having a null value returns a 1 which is the inversion you're wanting for a bad habit. Just make sure you're template's default value for that habit is a null and not false.

Would be nice if there was clearer one-line parameter that can invert a boolean like this. but this works for now.

KonkaBass avatar Feb 08 '24 10:02 KonkaBass