Thank you that works just like I was hoping. Your explanation is so helpful too as I am not a programmer and am just learning by doing and trying to copy other people until I get it. I was actually using some code from someone else that grouped by categories that I thought I removed, so that is what that was.
I am now having some trouble with my progress bar. I am using some code that works on a different table, but can’t get it to work here. I have fields in my note that gives a number for projects and total projects, but I am not sure what is breaking it. The error says Unexpected token ‘]’
Here is what I have
const result = dv.pages("#project")
.where(p => p.dateStarted && p.dateFinished === null)
.where(p => dv.date(p.dateStarted) !== null)
.sort(p => p.dateStarted, 'desc')
.map(p => [p.file.link, p.dateStarted, && k["projects"] / k["Total"] < 1 ? "<progress value=" + k["projects"] / k["Total"] + " max=1></progress>"]] );
// console.log(result); // uncomment the beginning of this line to check things
dv.table(["Project", "Date Started", "Progress"], result);
I was using the following code as my guide.
It would be great to be able to add the button as well, but I know its a lot and if I can just get the progress bar working I will be happy.
const {
update
} = this.app.plugins.plugins["metaedit"].api
const buttonMaker = (pn, pv, fpath, text) => {
const btn = this.container.createEl('button', {
"text": text,
"class": "button-55"
});
const file = this.app.vault.getAbstractFileByPath(fpath)
btn.addEventListener('click', async (evt) => {
evt.preventDefault();
await update(pn, pv, file);
}); return btn;
}
const
{ createButton
} = app.plugins.plugins["buttons"]
for (let group of dv.pages("#book").where(p => p["time-read"] == null && moment(luxon.DateTime.now().toISODate()).diff(moment(p["release-date"])) < 0).groupBy(p => p.dateStarted == null ? "Not dateStarted" : "Currently Reading")) {
dv.header(4, group.key + ": " + group.rows.length);
dv.table(["Title", "Author", "Series", "dateStarted On", " "],
group.rows.sort(k => k.dateStarted, 'desc').map(k => ["[[" + k.file.path + "|" + k["Title"] + "]]", k["Author"], k["Series"] ? k["Series"] + ", " + k["number-in-series"] : "N/A", k["dateStarted"] ? k["dateStarted"] : "Untouched", k["dateStarted"] && k["pageprogress"] / k["pagecount"] < 1 ? "<progress value=" + k["pageprogress"] / k["pagecount"] + " max=1></progress>" :
createButton({
app,
el: this.container,
args: {
name: k["dateStarted"] ? "Completed" : "Begin"
},
clickOverride: {
click: update,
params: [k["dateStarted"] ? "time-read" : "dateStarted", luxon.DateTime.now().toISODate(), k.file.path]
}
})
]))
}
It would be great to add the button as well, but I