0

Alerts that loop through multiple data points

Hello Pyramid team!

I'm trying to send an alert for every country in which the total talk time grew by 20%+ compared to last month, as seen in this discover:

 Since I have dozens of countries in my list, I can't create a separate alarm for each country.

Is there a way for me to create a process that loops through every country, check if there's a 20%+ increase and send an alert if the condition is met?

 

Thank you!

6 replies

null
    • NPANS
    • 7 mths ago
    • Reported - view

    The alerts are built using the dynamic text engine - which may have the formulas you need. 

    • So, build a basic alert.
    • Choose advanced in the dialog
    • Edit the trigger and add/update the logic of the trigger. 

    You might be able to construct a very complex formulation to capture what you want and then trigger the alert for you. You can use the "Loop" and "If" functions from the Common library to logically read your data points.  This is a hint of what may work.

    Loop(if(data(index,1)>0.20,label(1,1,index) + " - ",""), 0, 11)
    
      • Shir_BenGal
      • 7 mths ago
      • Reported - view

       Thank you, tried to do this but it seems that the alert dialog doesn't support the use of loops but only takes one argument at a time

    • Customer Solutions Architect
    • Moshe_Yossef
    • 7 mths ago
    • Reported - view

    Hi  ,

    Well, the easy way is to create a warning that will be sent if there is any row in the report that exceeds 20%.

    In your trigger definition you can try the following code:

    data(lookupMaxRow(FindColumnNumber("Growth - MTD vs. LMTD","false")),FindColumnNumber("Growth - MTD vs. LMTD","false"))
    > 0.2

    This code finds the column named "Growth - MTD vs. LMTD", and then finds the the row with the maximal value in it.

    If the data in the max row exceeds 0.2, it will create an alert.

    The alert can simply state that "there are states with more than 20% increase".

    Another approach is to this with a publication.

    Create a similar discover that is already filtered to rows exceeding 20% increase.

    Put this discover in a publication.

    Create a schedule for this publication including a trigger.

    The trigger can just be set to NumberOfRows()>0.

    It will send a publication notifying that there is a growth in at least one country, and the publication link will download a file with the list of countries and their data.

    I hope this helps,

      • Shir_BenGal
      • 7 mths ago
      • Reported - view

       
      Thank you, Moshe!
      I will probably use the second approach you suggested.

      • dgf
      • 2 days ago
      • Reported - view

       Hi Moshe (and hi  ;) ),

      I encountered the same issue and found this thread from google search. I have a table like Shir had but I need to send an alertcontains of two columns. I want to get only rows where Total Count >= 100 AND %_payment_failure >= 0.8. I also decided to follow the second approach, so I duplicated the discovery, filtered it and used the NumberOfRows()>0 to trigger.

      This is not a best practice since every change I do on the main discovery I have on the dashboard I also need to remember to apply on the filtered duplication I made for the publication.

      There must have a better more direct approach to do this.

      Please advice.

      • Customer Solutions Architect
      • Moshe_Yossef
      • 13 hrs ago
      • Reported - view

       

      Seems like what you want to do is maintain one discover that will serve both the dashboard and the publication.
      The idea is the same - you create a publication with the discover that you have in the dashboard, and you add a trigger that will only run if you have at least one row that meets your conditions.

      The challenge is how do you find out that you have a row that meets both your conditions.

      There are two options:

      1. you create a calculation (say you call "Attention Required") it - that will show 1 if the conditions are met and NULL if it isn't and add it to the grid. this means that every time there is a case where the conditions are met. then your trigger condition can simply ask if you have a column named like the calculation ("Attention Required")
      2. You can use the loop function to iterate through all the rows, and if a row meets the condition return a text, and otherwise return an empty text, so you end up with something like this:
      If(
            Length(
                Loop(
                    if(data(index,FindColumnNumber("Total Count", "false")) >= 100
                      &&
                      data(index,FindColumnNumber("%_payment_failure", "false")) >= 0.8
                      ,"1","")
                    ,0
                    ,NumberOfROws())
                )>0
        ,1,0)
      

      This loop will be longer than 0 if there is a row that meets both conditions.
       

      Personally, I would go with option 1 and avoid the loop calculation. it is simpler, and you can also use the "Attention Required" to show "!" colored in red so it pops out when you look at it either through dashboard and in the publication.

      I hope this helps.

Content aside

  • Status Answered
  • 13 hrs agoLast active
  • 6Replies
  • 62Views
  • 4 Following