Solved

displaying a count for the whole page of shapes that have a certain string in them


Badge +2

Im trying to count the number of times on a page that a certain string is there. 

All the shapes are not connected to each other, they are individual

 

this is what i have tried so far but i don’t think its getting me any closer

 

{{=count(FILTER(PAGE.DESCENDANTS, contains(@"Length", "50")))}

 

I have a data field attached to the shapes with the name ‘Length’ from a google sheet.

Im happy to either pull the string from there or from the actual displayed string

icon

Best answer by Shantel Gillette 2 July 2024, 23:02

View original

Comments

Userlevel 3
Badge +4

Good afternoon Luke,

I checked with some of our Lucid Formula experts, and the agreed on solution is to just switch PAGE.DESCENDANTS to DESCENDANTS(PAGE) . You also want to make sure that the field name you are pulling from matches exactly (no additional spaces or characters). Here are some possible ways you can write the formula.

=COUNT(FILTER(DESCENDANTS(PAGE), x => AND(ISNOTERROR(x."Length"), x."Length" = "50")))

  • The (ISNOTERROR) is probably not strictly necessary, but it can be useful doing checks that the properties exist.


=COUNT(FILTER(DESCENDANTS, x => CONTAINS(x."Length","50")))

 

=COUNT(FILTER(DESCENDANTS(PAGE), x => contains(x."Length", "50")))


Let me know if this helps! 

Badge +2

Thankyou, this works perfectly

=COUNT(FILTER(DESCENDANTS, x => CONTAINS(x."Length","50")))

 

Reply