Skip to main content
Question

Counting Instances of String across records for use in a Gauge Chart

  • June 27, 2025
  • 0 replies
  • 159 views

Forum|alt.badge.img+2

Hi all,

I want to use a gauge chart the displays the number of records that contain the letter 'R' as part of a string of in a 'Job Number' field, out of the total number of records in the table.

Typically a job number field value would be in the format of 00000_00, or 00000_A0, or 00000_R00. With R denoting revised.

I've tried using a query report formula, but whilst it's a valid formula attempt, it displays 0. The total number of records for the gauge 

var text QUERY = 
  "{6.EX." & Contains([Job Number], "R") & "}";

Size(
GetRecords($QUERY))

My logic to the above is that its querying the data table, for job number field (ID 6) to see if it contains a string with an 'R' in it, and if so count the total number of true records.

Any ideas?

It would be awesome if the gauge can be coloured to show the revised element in red, but the remainder of the gauge in green. But I really think that's beyond the limits of what is possible. However, if anyone has an idea how this could be accomplished, that would be absolutely appreciated!

Forum|alt.badge.img+2
  • Registered
  • June 27, 2025

To get the count, try changing your query to that below.  You can use the built in CT operator (contains).

var text QUERY = "{6.CT.'" & "R"  & "'}";


Forum|alt.badge.img+2
  • Registered
  • June 27, 2025

I tested in one of my apps and didn't see the behavior you are describing.

As a simpler solution, can you create the Gauge chart and simply filter where the job number field contains the value R?

I get the same number with the CT query and filter.

If you still have an issue, there may be something I'm missing in the set up.