Skip to main content
Solved

BUG: COUNTIF(source, x=> GET(x, this."Field") = this."Value") fails when "FIELD" is the output of a formula

  • 18 July 2024
  • 5 replies
  • 49 views

I've created a shape object that has three fields. One field is named "Field" this is the column name of a data source where I want to count values in the rows that match a specific value. The next field is named "Value" this is the text value I want to match and count in the column of the data source. Finally I have a third field named "Count" that has a formula that counts the rows in the data source where the name matches. This solution has worked great for the last week or so. I can duplicate the shape and change the "Field" value or the "Value" value and I get the counts I want, very reusable.

 

I wanted to evolve this by putting my shape in a container and having the "Field" value be a formula that pulled the value of the container name/label. When I did this it seemed to work the new "Dynamic Field" pulled the value I wanted that matched the static "Field" value. But when I updated the formula to use the "Dynamic Field" value my count ended up being 0.

 

 

Screen shot of the "Count" formula and values.

 

Screen shot of "Dynamic Count" formula and values.

 

Screen shot of the Dynamic Field formula and values.

 

 

Comments

Badge +3

It looks like two screen shots were not uploaded here they are.

 

Screen shot of "Dynamic Count" formula and values.

 

Screen shot of the Dynamic Field formula and values.

 

Userlevel 4
Badge +7

Hi Jonathan, thank you for contributing to the Lucid Community. I’m taking a look at your question and will get back to you shortly once I have more information. 

Badge +3

My only guess is that there is an order of operations issues. The field on the shape that I want a value from hasn’t populated at the point the other field tries to use the value. That would explain why the field shows a value in the editor but the field that uses the result show empty when it run. If you need a document setup like this let me know and I can build one with non team data.

Badge +3

I found the problem, it was hard to see but apparently this formula `=CONTAINEDBY[1]` was returning a leading space. I wrapped it in TRIM  `=TRIM(CONTAINEDBY[1])` and it is now working for me. I’ll have to see where that leading space came from but the TRIM solution feels clean enough to me to solve the problem.

Userlevel 4
Badge +7

Thank you, @Jonathan M102, for sharing the solution and your thought process behind it!

Reply