Count array with multiple due dates and display only the end

What I’m trying to do

The final end result in my Dataview would have a field that shows only the latest due date with the number of times it has changed in parenthesis. Like this.
2023-05-22 (3)

It should be noted that in my Yaml, I will add multiple due dates like this. I stumbled across the fact that multiple Yaml items with the same key just takes the latest. However, multiple inline creates an array. Both have their applications.

Due_Date:: 2022-02-02
Due_Date:: 2023-03-03
Due_Date:: 2023-04-04

Things I have tried

The final end result in my Dataview would have a field that shows only the latest due date with the number of times it has changed in parenthesis. Like this.
2023-05-22 (3)

Things I have tried

As you can see, this is what my DV looks like prior to the following query.

Table without ID 
	Icon + " " + file.link as "Project", 
	choice(Status = "In Progress", 
		"<span class='my_status_pill my_status_in_progress'>In Progress</span>", 
		choice(Status = "On Track", 
			"<span class='my_status_pill my_status_on_track'>On Track</span>", 
			choice(Status = "At Risk", 
				"<span class='my_status_pill my_status_at_risk'>At Risk</span>", 
				choice(Status = "Scope Creep", 
					"<span class='my_status_pill my_status_scope_creep'>Scope Creep</span>", 
					choice(Status = "Behind", 
						"<span class='my_status_pill my_status_behind'>Behind</span>", 
							Status))))) as Status,
	default(aliases[0], SPA) as Contact, 
	join(Plants, ", ") As Sites, 
	dateformat(Due_Date, "yyyy-MM-dd") as Due, 
	
	length(Due_Date) as "T-Date Changes",
	Due_Date[length(Due_Date)-1] as "T-Latest Due",
	
	"<progress value='" + Progress + "' max='100'></progress> " + Progress + "%" AS Progress,
	nextAction.text as "Next Action" 

From 
	"Test_Projects"
	AND "Test_Projects" flatten file.tasks[0] as nextAction
Where 
	(Status != "On Hold" AND Status != "Planned" AND Status != "Cancelled") 
	AND file.name!= "Project Setup"
Sort
	Due_Date Asc, 
	file.name Asc

This is what it looks like after. The query breaks… by break I mean it no longer shows project 2 & 3. However, two additional fields seem to be doing what I want.

Those repeated definitions are indeed not present within dataview, so you’ll need to change your syntax in order for them to appear and be handled by any query.

So lookup array/lists in the frontmatter, or try something like:

---
Due-date:
- 2022-02-02
- 2023-03-03
- 2024-04-04
---

This, if my memory serves me right, is one of the variants to properly create a list of values in the frontmatter.

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