How to :: Create a dynamic date in an app

These are the few steps to have an app always up to date regarding a date that is dynamic and contained in a file for example.

  1. In the dataframe that you’ll be using to generate your reports add a new column that will contain this dynamic date. This generally has to be done in your augment.py script. In you etl_config.cson

    REPORTS: [
      query:
        domain: "reports"
        default: 1
      template: "report"
    ]
    

    the reports domain should contain a COLUMN_FOR_LAST_UPDATE column name.

  2. Create a new key in your report.cson that will contain this dynamic date, for example last_update. The date key is reserved for the date requester in the dashboard.

    name: "Report Name"
    entityName: "{{ BU }}"
    id: "{{ index }}"
    last_update: "{{COLUMN_FOR_LAST_UPDATE}}"
    

    Doing so when you’ll populate your reports the dynamic date will be stored in the report object.

  3. In your front_config.cson use the dynamic syntax for templating in your data queries.

    chartOptions:
        data:
          query:
            domain: "MY_DOMAIN"
            date: "<%= report.last_update %>"
    

Important

Note that the value of the dynamic date will be cast as a string while creating the reports from the report.cson so in the previous example in the front config the date field should be a string too