Graphics

 View Only
  • 1.  Count number of times a string says something

    Posted 10-14-2025 13:28

    I have a datalinq that pulls in as one string with commas as separators. "true, false, false, false, true, true" and I need the text to spit out the number of times that says true. I dont mind using multiple text objects if needed, but would like to pull in that datalinq and then the text object text to spit out the number of times it says true so "3" would be visible

    is this possible?



    ------------------------------
    HM
    ------------------------------


  • 2.  RE: Count number of times a string says something

    Posted 10-15-2025 12:44

    I know there are ways to do this with scripting, but if you want to use Visual Logic, you can use a String Replace to remove all of the "true" strings, then subtract the length of that replace string from the original string, divide by 4 (the amount of characters in "true") and use the format float to get rid of the decimal points.



    ------------------------------
    Jeff Mayer
    Ross Video
    ------------------------------



  • 3.  RE: Count number of times a string says something

    Posted 10-20-2025 09:13

    If you're keen to use a script you can do the following;

    Dim temp As String
    Dim count As Integer
    Dim pos As Integer
     
    temp = Text
    count = 0
     
    Do
        pos = InStr(temp, "true")
        If pos = 0 Then Exit Do
        count = count + 1
        temp = Mid(temp, pos + 4)
    Loop
     
    Text = CStr(count)



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------