How to display the datetime of the Eazy BI Data Import

We are trying to display a datetime column in our reporting that reflects the datetime of the last EazyBi data import - ala “Values in this report are accurate as of: 3/10/2024, 2:58:29 PM EDT”

We cannot figure out how to properly do this.

Implementing custom javascript code that populates a datetime as a custom field within advanced settings simply populates the date a given issue was originally imported. And it also doesn’t seem to update on the next import. So the below doesn’t seem to do the job we need it to.

[jira.customfield_importtimestamp]
name = "Import Datetime"
data_type = "string"
dimension = true
javascript_code = '''
var mydate = new Date().toLocaleString("en-US", {timeZone: "America/New_York", timeZoneName: "short"})

return mydate;

'''

The reports in EazyBi update on their schedule and also when we manually press the import button just fine.

Also completely understand these are single events that take place at a single, specific time.

How do we get a single common value in our reports that is the same across all issues and only changes when an import is run? Btw we use the CSV export api for technically important reasons - so the PDF and other non-column export formats won’t work for us.

Thx!

1 Like

Bump. Anyone know how to do the above?

Hi @manifolddigital,

Users can see the last data import When they interact with the report. A clock icon in the report header is visible when hovering the cursor over it.

However, this information is not available if you subscribe to or download dashboards in PDF format. Then, you can consider making a report with calculations that check on the latest data. I can think of three different solutions:

  1. Create a new calculated measure in eazyBI.The calculation would look for the latest issue updated date and time. Logically, this would be the best approach as it would show the last issue changes imported into eazyBI. The expression would look like this:

    TimestampToDate(
      --get the latest timestamp
      Max(
        --check on all issues
        [Issue].[Issue].Members,
        --convert the updated date to the timestamp for comparison so that Max() works
        DateToTimestamp([Issue].CurrentMember.Get('Updated at'))
      )
    )
    

    Set measure formatting to Date and time.

  2. Another option is to create new calculated measure and check on the latest transition date and time when any issues were created or moved to some status. This calculation would be the fastest solution but might not represent the actual import date and time. This could be a great solution for large accounts with dynamic issue changes as it is fast calcaution. The expression for the calculated measure is this:

    TimestampToDate(
      DefaultContext([Measures].[Transition to last timestamp])
    )
    

    Set measure formatting to Date and time.

  3. The third option is to fine-tune your solution with a calculated field. The calculation woudl import the timestamp of the last import for each issue. The idea is to import the timestamp as an integer to find the latest timestamp with calculations faster.

    3.1 In import options, add new calcauted field to capture the last import date and time for each issue and import this field as property. The field configuration should look like the one in the picture below.

    And here is the code for JavaSript from the example:

    var mydate = new Date()
    return Math.floor(mydate.getTime()/1000);
    

    More details on calcauted fields and how to create and validate them are described in the documentation: New calculated fields

    3.2 In a report, create new calculated measure to find the latest timestamp among all issues.

    TimestampToDate(
      --get the latest timestamp
      Max(
        --check on all issues
        [Issue].[Issue].Members,
        --compare the timestam
        CAST([Issue].CurrentHierarchyMember.get('Import Datetime') as INTEGER)
      )
    )
    

    Set measure formatting to Date and time.

More details on calcauted measures and formatting are described here: Calculated measures.

Best,
Zane / support@eazyBI.com

Thanks - unfortunately it seems that Javascript is failing on import. Are we sure that this javascript is compatible and works during import?

Nevermind! I think it may work. Testing now.

Thanks @zane.baranovska

So it appears to have worked on the initial import. But doesn’t seem to be refreshing with newer dates on subsequent imports. Anything we can do so that it’s truly an accurate timestamp of the latest import?

The JavaScript would populate the import date only for issues that have been changed since the last import because eazyBI imports only incremental changes. The 1st option with the issue update date and the 3rd option with JavaScrip are similar.