Ad Widget

Collapse

Function COUNT

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mauro
    Member
    • Jan 2017
    • 94

    #1

    Function COUNT

    Hello.
    Little problem.

    it's probably my problem that I didn't understand what the function does ...
    I need to count how many times a word appears in the last item acquired.
    specifically I have to count how many times "successfully" happens, if it is not equal to two I have to raise the trigger.
    then this is my simple code:
    {HOST07:testRestore.count(#1,successfully)}<>2

    but it does not work.

    the item vaule is this:

    **************************************************
    *********** TEST DI RESTORE FILE ********
    **************************************************
    *********** DATA TEST: 27.07.2019 6:00:03,18
    **************************************************
    Test recupero file: C:\DASHARE\unins000.dat
    Il test e' valido se al termine compare la scritta 'The operation completed successfully.'
    **************************************************
    Total time: 00:00:05
    The operation completed successfully.


    even with the test (under trigger constructor) I always get false.
    I tried in many way... nothing.

  • AvaTTaR
    Member
    • Dec 2018
    • 96

    #2
    I didn`t get clear what exactly you need..

    If we talk about how many last ten results includes a word "acquired" than it will be count(#10,"acquired")

    about {HOST07:testRestore.count(#1,successfully)}<>2 your misstake is in count of results and better comment strings - {HOST07:testRestore.count(#2,"successfully")}<>2

    Comment

    • mauro
      Member
      • Jan 2017
      • 94

      #3
      Thx for reply.
      I need to know how many times appears the word "succesfully" in the last value of the item "testRestore".
      I thought of using the count function, setting as the first parameter #1 but the result il always false .
      In the example shown it is clear that it should be false (there are two "succesfully" and the condition is <> 2) but it is still false even if I put <> 1 or if I change the test value with only one occurrence.

      Comment

      • mauro
        Member
        • Jan 2017
        • 94

        #4
        Ok, we bypass the obstacle.
        at this point I could do this:
        {HOST07:testRestore.count (# 1, ^*successfully*succesfully* $)} <> 1

        so it should go and reach the goal.
        but I still can't get it to work.

        ideas?
        Last edited by mauro; 29-07-2019, 14:32.

        Comment

        • mauro
          Member
          • Jan 2017
          • 94

          #5
          resolved in this way:
          {HOST07:testRestore.regexp(.*successfully.*success fully.*,#1)}=0
          and now works.

          Comment

          Working...