Skip to content Skip to footer

How to set Scheduled Reports?

Sample JSON

{
    "B-PROPERTIES":{
        "R-TYPE":REPORT TYPE 1/2,
        "R-FORM-NAME":EMAIL SUBJECT REPORT NAME,
        "R-NAME":EMAIL BODY REPORT NAME,
        "R-NOTIFICATION-TYPE":["email"],
        "R-SAVED-SEARCH-ID":ADVANCE SEARCH FILTER ID,
        "app":{"app_id":APP ID,"appversion":APP VERSION},
        "R-OCCURRENCE-TYPE":"recurring",
        "R-FORM-TIME":FROM TIME FOR DATE FILTER,
        "R-TO-TIME":TO TIME FOR DATE FILTER,
        "R-INCLUDE-TODAY":INCLUDE TODAY'S DATE IN REPORT,
        "R-INCLUDE-TIME":INCLUDE FROM TIME/TO TIME IN REPORT,
        "R-USERS":[TO USER EMAIL],
        "R-USERS-BCC":[BCC USER EMAIL],
        "R-DATE":TRIGGER DATE IN UTC,
        "R-SCHEDULE-FREQUENCY-TYPE":FREQUENCY TYPE,
        "R-SCHEDULE-FREQUENCY":FREQUENCY VALUE
    },
    "R-PROPERTIES":{
        "asset_form_id": FORM ID,
        "export_type": REPORT TYPE regular or custom report function name,
        "export_fields": EXPORT FILEDS IF ANY,
        "fo_info": ADVANCE SEARCH TREE,
        "keyword": KEYWORD IF ANY,
        "search_query_tree": SEARCH QUERY TREE
    }
}
  • Scheduled Report requires json provided above
  • It consists of 2 keys
    • B-PROPERTIES – Used by scheduler to create filters and schedule report
    • R-PROPERTIES – Used by export manager for data filters and export type
      • export_type:
        • regular – This will create default report for asset_form_id
        • all_data_export – This will create all data report with all forms, refer following document to configure all data report in app.
  • Schedule report using python shell
from axonator.managers.behavior_manager import BehaviorFactory
# Get report behavior manager from behavior factory
report_manager = BehaviorFactory.get_all_behaviors()['REPORT']
# report behavior properties
report_properties = {
    "B-PROPERTIES": {
        "R-TYPE": "1",
        "R-FORM-NAME": "Staff Deployment Report",
        "R-NAME": "Afternoon Shift Report",
        "R-NOTIFICATION-TYPE": ["email"],
        "R-SAVED-SEARCH-ID": None,
        "app": {"app_id": "4878", "appversion": "2"},
        "R-OCCURRENCE-TYPE": "recurring",
        "R-FORM-TIME": "14:00",
        "R-TO-TIME": "14:00",
        "R-INCLUDE-TODAY": True,
        "R-INCLUDE-TIME": True,
        "R-USERS": ["gopal@clrservices.com"],
        "R-USERS-BCC": ["kajal@axonator.com"],
        "R-DATE": "2021-04-29 02:30",
        "R-SCHEDULE-FREQUENCY-TYPE": "day",
        "R-SCHEDULE-FREQUENCY": 1,
    },
    "R-PROPERTIES": {
        u"asset_form_id": "245678",
        u"export_type": "staff_deployment_export",
        "export_fields": {
            "current_terminal": "cba52af786414c3b847d1cd37fd9bb74",
            "current_shift": "Afternoon",
        },
        u"fo_info": None,
        u"from_date": u"",
        u"keyword": u"",
        u"search_query_tree": None,
        u"to_date": u"",
    },
}
# Initialise report manager with report properties
report_manager_object = report_manager(**report_properties)
# This will create scheduled app export plan and event for report behavior
report_manager_object.process() 

Was This Article Helpful?

0
0 Comments

There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *

Close Bitnami banner
Bitnami