Formula to count checkboxes in description

Hi all, for some projects I don’t need the full scope of project/task database and sometimes use the simple checkboxes directly in the description. However it can be difficult to know what entities contain these checkboxes.

Is anyone aware of a formula that could find/count complete/incomplete checkboxes that are in Descriptions/Rich Text fields?

1 Like

I don’t think it’s possible with formulas I’m afraid.
However, you can use an automation to calculate how many ticked/unticked checkboxes there are (and put the result in some fields of your choice):

const fibery = context.getService('fibery');

for (const entity of args.currentEntities) {
    const content = await fibery.getDocumentContent(entity['Description']['Secret'], 'md');
    const tickedregex = /- \[x\]/g
    const ticked = content.match(tickedregex);
    const untickedregex = /- \[ \]/g
    const unticked = content.match(untickedregex);
    await fibery.updateEntity(entity.type,, { 'Ticked': ticked.length, 'Unticked': unticked.length });

This looks in the Description field and puts the counts of ticked/unticked as values in the ‘Ticked’ and ‘Unticked’ number fields.

You could have this run as an automation that triggers whenever there is an update to the Description field.