I'm trying to make a table for working on projects using the "progress bar". In general, it works, but if there are no tasks, then division by 0 occurs. How can I make a string or symbol be displayed in this case? Tried to use "||" operators and "or", but got an error.
What I’m trying to do
table WITHOUT ID (link(file.path, alias)) as Project, length(filter(file.tasks, (t) => t.completed)) AS "yes", length(file.tasks) AS "all", "![progress](https://progress-bar.dev/" + round((length(filter(file.tasks, (t) => t.completed)) / length(file.tasks)) * 100) + "/)" AS Progress, status AS Status
where type = "project" and status != "archive" and file.name != "project note"
SORT file.path ASC
<!-- THIS PART WON'T BE POSTED
Please describe what you're trying to accomplish so the community can better help you. Sometimes the solution you have in mind is not necessarily the best option, in which case knowing some background info can let others come up with creative solutions for your use case.
Please continue below this line. -->