# Heatmap Calendar WHERE clause Link

**URL:** <https://forum.obsidian.md/t/heatmap-calendar-where-clause-link/68007>\
**Category:** Help\
**Created:** [September 23, 2023, 8:36pm UTC](https://forum.obsidian.md/t/heatmap-calendar-where-clause-link/68007 "2023-09-23T20:36:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mr\_anh\_ngoc](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/90ced4/32.png) [@mr\_anh\_ngoc](https://forum.obsidian.md/u/mr_anh_ngoc)\
**Post date:** [September 23, 2023, 8:36pm UTC](https://forum.obsidian.md/t/heatmap-calendar-where-clause-link/68007/1 "2023-09-23T20:36:10Z")

</div>

Hi,

### What I’m trying to do

I want to limit the output of the heatmap calendar with a WHERE clause.  
In this case I only want the output for files with the link `[[leisure]]`

### Things I have tried

the relevant line is:

```auto
.where(p => p.type == "[[leisure]]")

```

hereby type is an inline field.  
The whole code looks like this:

````auto
```dataviewjs
dv.span("# all amounts") 
const calendarData = 
{
    year: 2023, // (optional) defaults to current year
    colors: 
    {
	    red: ["#ffc9ba", "#FC8868", "#FC3700", "#D43100", "#942000"] 
    },
    showCurrentDayBorder: true, // (optional) defaults to true
    defaultEntryIntensity: 4, // (optional) defaults to 4
    intensityScaleStart: 0, // (optional) defaults to lowest value passed to entries.intensity
    intensityScaleEnd: 1500,
    entries: [],
}
//DataviewJS loop
for (let page of dv.pages('"my_folder"')
	 .where(p => p.amount)
	 .where(p => p.type == "[[leisure]]")
	  )
	 {
	    //dv.span("<br>" + page.file.name) // uncomment for troubleshooting
	    let month = page.file.cday.month <= 10 ? "0"+page.file.cday.month : page.file.cday.month;
	    let day = page.file.cday.day <= 10 ? "0"+page.file.cday.day : page.file.cday.day;
	    let uglydate = page.file.cday.year+"-"+month+"-"+day;
	    calendarData.entries.push(
	    {
	        date: uglydate,  
	        intensity: page.amount,
	        content: dv.span(`[[${page.file.name}|]]`),
	    })
	}

renderHeatmapCalendar(this.container, calendarData)
```

````

without the WHERE clause with the link I get:

 ![grafik](https://forum.obsidian.md/uploads/default/original/3X/5/9/59282b9235eff36060eac80b836546f6de59b976.png)

As soon I set in the relevant (link) line, there is an empty output.

Which syntax I have to use?

---

<div class="post-metadata">

**Author:** ![mr\_anh\_ngoc](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/90ced4/32.png) [@mr\_anh\_ngoc](https://forum.obsidian.md/u/mr_anh_ngoc)\
**Post date:** [September 23, 2023, 10:40pm UTC](https://forum.obsidian.md/t/heatmap-calendar-where-clause-link/68007/2 "2023-09-23T22:40:34Z")

</div>

rummaging around on discord, I found something

```auto
.where(p => p.type == "[[leisure]]")

```

has to be changed to

```auto
.where(p => String(p.type).includes("leisure"))

```

that works… for now.  
If someone has a better more elegant solution, please let me know.

Thanks to all who have stopped by  
…and good night

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [September 30, 2023, 10:41pm UTC](https://forum.obsidian.md/t/heatmap-calendar-where-clause-link/68007/3 "2023-09-30T22:41:00Z")

</div>

Closed on September 30, 2023, 10:41pm UTC

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