0

If there is a data which is configured as time in webdatarocks, then it is exported correctly in hh:mm:ss format in Excel. But if we have a calculated value which is obtained by dividing time value by numeric value (to get average) and this calculated value is defined as time, then in web it is shown in correct format, but in export - in seconds. Below is sample from webdatarocks codepen where I have added new value AVG. It is shown as 00:20:00 on web, but exported as 1200 in excel

        "Duration": {
            type: "time"
        },
        "Movie Name": {
            type: "string"
        },
  "AVG": {
            type: "time"
        },
        "Rating": {
            type: "number"
        },
        "Genre": {
            type: "string"
        }
    },
    {
        "Movie Name": "Star Wars: The Last Jedi",
        "Rating": 7.2,
        "Genre": "Fantasy",
        "Duration": 9120
    },
    {
        "Movie Name": "Blade Runner 2049",
        "Rating": 7.2,
        "Genre": "Sci-Fi",
        "Duration": 9840
    },
    {
        "Movie Name": "Harry Potter and the Sorcerer's Stone",
        "Rating": 7.6,
        "Genre": "Adventure",
        "Duration": 9120
    },
    {
        "Movie Name": "Incredibles 2",
        "Rating": 8.1,
        "Genre": "Animation",
        "Duration": 7080
    },
    {
        "Movie Name": "Ratatouille",
        "Rating": 8.0,
        "Genre": "Comedy",
        "Duration": 6660
    },
    {
        "Movie Name": "Scott Pilgrim vs. the World",
        "Rating": 7.5,
        "Genre": "Romance",
        "Duration": 6720
    }
];
var pivot = new WebDataRocks({
    container: "wdr-component",
    toolbar: true,
    report: {
        dataSource: {
            data: JSONData
        },
    "slice": {
          "rows": [
              {
                  "uniqueName": "Movie Name"
              }
          ],
          "columns": [
              {
                  "uniqueName": "Genre"
              },
              {
                  "uniqueName": "Duration"
              },
              {
                  "uniqueName": "Measures"
              }
          ],
          "measures": [
              {
                  "uniqueName": "Rating",
                  "aggregation": "sum"
              },
            {
                "uniqueName": "AVG",
                "formula": "sum(\"Duration\") / sum(\"Rating\")",
                "caption": "Avg"
            },
          ],
          "expands": {
              "columns": [
                  {
                      "tuple": [
                          "Genre.Adventure"
                      ]
                  },
                  {
                      "tuple": [
                          "Genre.Animation"
                      ]
                  },
                  {
                      "tuple": [
                          "Genre.Comedy"
                      ]
                  },
                  {
                      "tuple": [
                          "Genre.Fantasy"
                      ]
                  }
              ]
          }
      }
    }
});

1 Answers1

0

Currently, WebDataRocks does not provide an option of setting a time format of the calculated measures for export.