Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

Is there a way to export measured time to excel keeping a pattern?

Answered
RPanh asked on March 10, 2020

Is there a way to export measured time to excel keeping a pattern? If it OK if time will be exported as plaintext or decimal.

3 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 11, 2020

Hello,
 
Thank you for reaching out to us.
 
We would like to kindly inform you that time pattern can be applied while exporting to Excel in case the hierarchy containing time will be chosen for rows/columns, and not for measures. In such case, it will be formatted as a plain text in Excel. Being chosen for measures, values will be formatted using the default Excel pattern. Such behavior is due to the difficulties in converting Flexmonster date patterns to Excel` ones.
 
Please see an example where the difference between exporting “Date” hierarchy placed in measures and in rows is demonstrated.
 
We hope it helps.
 
Do not hesitate to contact us in case of additional questions on this point.
 
Kind regards,
Illia

Public
RPanh March 12, 2020

Hello,
 
Thank you very much for your response.
I’d suggest to add an export setting for excel export time format, as I’m not first one to encounter this problem.
Kind regards

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 12, 2020

Hello,
 
Thank you for your feedback and for sharing your suggestions with us.
 
Your request has been added to our backlog. However, we would like to kindly inform you that our team is not ready to provide you with an exact ETA on this feature due to difficulties while converting formatting patterns and the fact that our road map is full at the moment.
 
Also, we would like to suggest the workaround that may fit your case. It is possible to adjust the custom function that would parse seconds in an appropriate format and export the formatted value as a plain text to Excel.
 
Please see an example we have prepared for you. It uses Moment.js library that can be simply included in your project by adding the following script tag:

<script src="<https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js>" integrity="sha256-4iQZ6BVL4qNKlQ27TExEhBN1HFPvAvAMbFavKKosSWQ=" crossorigin="anonymous"></script>

The idea is to define the type of the “Time” hierarchy as number and replace the content of the cell with an appropriately formatted value. Our team would like to draw your attention to the following code snippet:

flexmonster.customizeCell(function customizeCellFunction(cell, data) {
if (data.measure && data.type != 'header' && data.measure.uniqueName == "Time") {
cell.text = moment.utc(data.value*1000).format('HH[h] mm[m] ss[s]');
}
});

It uses the customizeCell API provided by Flexmonster in order to find cells representing time and replace their content with formatted data. The formatting itself is performed by Moment.js library:

moment.utc(data.value*1000).format('HH[h] mm[m] ss[s]');

 
Such an approach allows exporting the time in the predefined format to Excel as plain text.
 
Please find out more about customizeCell API in our documentation.
 
We hope it works for you.
 
Do not hesitate to contact us in case any additional questions occur.
 
Best regards,
Illia

Please login or Register to Submit Answer