Forum Discussion

ScottRobertson's avatar
ScottRobertson
Qrew Trainee
5 years ago

Count the number of specific characters in text field

Hello,

Is it possible to count the number of specific characters within a text field? What I'm looking to do is count the number of delimiters (";") within a text field to determine the number of entries in a field (this isn't something that can be separated into different fields).

Examples: 
  • hello;world;test;1;2;3; = 6
  • hello; = 1
  • ;;;; = 4

I was looking into removing all text besides the delimiter and using the Length formula, but haven't had any luck!

Thanks!

------------------------------
Scott Robertson
------------------------------

6 Replies

  • Try this, but it will not work for your last example as there is no text in between the delimiters.

    var text value = [my field];

    Count(
    Trim(Part($value,1,";"))<>"",
    Trim(Part($value,2,";"))<>"",
    Trim(Part($value,3,";"))<>"",
    Trim(Part($value,4,";"))<>"",
    Trim(Part($value,5,";"))<>"",
    Trim(Part($value,6,";"))<>"",
    Trim(Part($value,7,";"))<>"",
    Trim(Part($value,8,";"))<>"",
    Trim(Part($value,9,";"))<>"",
    Trim(Part($value,10,";"))<>"",
    Trim(Part($value,11,";"))<>"",
    Trim(Part($value,12,";"))<>"",
    Trim(Part($value,13,";"))<>"",
    Trim(Part($value,14,";"))<>"",
    Trim(Part($value,15,";"))<>"",
    Trim(Part($value,16,";"))<>"",
    Trim(Part($value,17,";"))<>"",
    Trim(Part($value,18,";"))<>"",
    Trim(Part($value,19,";"))<>"",
    Trim(Part($value,20,";"))<>"",
    Trim(Part($value,21,";"))<>"",
    Trim(Part($value,22,";"))<>"",
    Trim(Part($value,23,";"))<>"",
    Trim(Part($value,24,";"))<>"",
    Trim(Part($value,25,";"))<>"")

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------
    • ScottRobertson's avatar
      ScottRobertson
      Qrew Trainee
      Appreciate the input!

      ​The other issue I failed to mention is that the length of that field can range from 1 delimiter to 50,000+... would I need to complete 50,000 "trims" with this solution?
      Trim(Part($value,1,";"))<>"",
      Trim(Part($value,2,";"))<>"",
      Trim(Part($value,3,";"))<>"",
      Trim(Part($value,50000,";"))<>"",


      ------------------------------
      Scott Robertson
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Qrew Champion
        Yes, 50,000, which I'm sure would hit either Quick Base limits or limits of your patience.  This would require a JavaScript solution.

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        markshnier2@gmail.com
        ------------------------------
  • BabiPanjikar's avatar
    BabiPanjikar
    Qrew Assistant Captain
    It looks like Mark got the solution you need.

    ------------------------------
    Babi Panjikar
    ------------------------------