How to customize the format of date type filed for grandTotal row?

Answered
uchivoitachi asked on August 31, 2021

Hello Team,
 
Is there a way to customize the format of date-type field for grandTotal row in flat form?
Please see the attachement,the date type column in flat form is "dd/MM/yyyy" format,however,the same field of grandTotal row is displayed as another pattern "dd/MM/yyyy HH:mm:ss",is there a way to consistent it with the other rows?e.g. "dd/MM/yyyy", thanks.

Attachments:
grandtotal format.jpg

10 answers

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster August 31, 2021

Hi!
 
Thank you for posting your question.
 
Any chance you could send us your report and a dummy dataset with which this issue is reproducible? This would help us understand your situation and provide you with a solution faster.
 
Looking forward to your response.
 
Best regards,
Mykhailo

Public
uchivoitachi September 1, 2021

Dear Team,
 
Thanks for the support!
Below is basic info and how-reproduce steps for the issue,hope it's helpful.
And also attached the flat form report.json for your reference.
Basic information:
Pivot View:
datasouceType: elasticsearch
I added a context menu named “To Flat Form” for pivot view value cells, below is what will happen when click this context menu:
1). Build a query json(same as Drill through),we can use this query json to fetch drill through raw-records from elasticsearch via a backend service.
2). Fetch raw data from Elasticsearch, then try to build a new Report Object with the returned raw data, at this moment, will change the datasouceType from elastichsearch to “json”, add “data” attribute in the dataSource object, the other attributes of the target report are the same as original(pivot view).
3). During build the target Report Object in Step 2), I will add “type” and “format” attributes for report.dataSource.mapping[field] object, in this case, for date type field, I add “type:’datetime’,format:’dd/MM/yyyy’.
4).The result of the target report will shows grandTotal and other rows with different datetime format.

Attachments:
report.json

Public
uchivoitachi September 1, 2021

Dear Team,
 
Thanks for the support!
Below is basic info and how-reproduce steps for the issue,hope it's helpful.
And also attached the flat form report.json for your reference.
Basic information:
Pivot View:
datasouceType: elasticsearch
I added a context menu named “To Flat Form” for pivot view value cells, below is what will happen when click this context menu:
1). Build a query json(same as Drill through),we can use this query json to fetch drill through raw-records from elasticsearch via a backend service.
2). Fetch raw data from Elasticsearch, then try to build a new Report Object with the returned raw data, at this moment, will change the datasouceType from elastichsearch to “json”, add “data” attribute in the dataSource object, the other attributes of the target report are the same as original(pivot view).
3). During build the target Report Object in Step 2), I will add “type” and “format” attributes for report.dataSource.mapping[field] object, in this case, for date type field, I add “type:’datetime’,format:’dd/MM/yyyy’.
4).The result of the target report will shows grandTotal and other rows with different datetime format.

Attachments:
report.json

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster September 1, 2021

Hi,
 
Thank you for describing your issue in detail!
 
The easiest solution here would be to set a default date-time pattern for the whole Flexmonster instance – you can do so with the dateTimePattern option:
 

options: {
dateTimePattern: "dd/MM/yyyy"
}

 
This way, the totals cells will also be affected by the formatting. Also, if you set the dateTimePattern, specifying the format property in mapping is unnecessary.
 
Please let us know if this helps.
 
Best regards,
Mykhailo

Public
uchivoitachi September 2, 2021

Dear Team,
 
Thanks for the suggestion ant it's very helpful when there is only one date type field or all date type fields are with a same format pattern.
 
However, if there are multiple date type fields and one is set to "dd/MM/yyyy" and the others set to "dd/MM/yyy HH:mm:ss",use options.dateTimePattern it will affect all date type fields of total rows,but I want the total date type fields' format keep the same as other rows,is there a better way to achieve this?Thanks!
Please refer to the attached screenshot,thanks again.
 
 
 
 
 

Attachments:
datetimepattern.jpg

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster September 2, 2021

Hi,
 
Thank you for your response.
 
You're right, this becomes difficult to handle when you need to define different formats for multiple datetime fields.
 
We are going to fix the behavior of the format property of the Mapping object so that the defined format is applied to the totals as well. The fix will become available in our upcoming release ETA Sep 20th.
 
We'll keep you posted.
 
Best regards,
Mykhailo

Public
uchivoitachi September 3, 2021

Dear Team,
 
Thanks very much!
We will test this issue once the new version released,thanks for you guys so much! 
 

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster September 21, 2021

Hi!
 
Hope you're doing well.
 
We've introduced a fix addressing the issue with date format not being applied to grand total row in flat form.
 
It is available in the 2.9.8 version of Flexmonster: https://www.flexmonster.com/release-notes/.
 
You are welcome to update the component. Here is our updating to the latest version guide for assistance: https://www.flexmonster.com/doc/updating-to-the-latest-version/.
 
Please let us know if everything works well for you.
 
Best regards,
Mykhailo

Public
uchivoitachi September 24, 2021

Thanks Team & we'll test the feature, thanks you guys so much!

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster October 5, 2021

Hi,
 
How are you?
 
Just checking in to ask if you've had a chance to test out the fix we've introduced last month. Is everything working well for you?
 
We would be happy to hear your feedback!
 
Regards,
Mykhailo

Please login or Register to Submit Answer