Generic dataset - date formating |
Post Reply ![]() |
Author | ||
Sriram Ambuga ![]() New Member ![]() Joined: 14 Oct 2019 Posts: 1 |
![]() ![]() ![]() ![]() Posted: 14 Oct 2019 at 2:44pm |
|
Hi,
We have created a report template on similar lines as Generic Reports 2.template.xls provided in the samples - except the formatting part. In the sample file the formatting for date is applied based on the column name - but in our case since the report template is used across different datasets we cannot have condition based formatting i.e the <#if(<#columns.name>="OrderDate";<#format cell(longdate)>;)> is not possible. When we generate the report now it displays date as numbers (and the excel column type is general). Is there a way to get the column type so we can apply the format conditions? Or is there any other method we can use to get the date format working. The same is the case for currency (but less critical). Thanks.
|
||
![]() |
||
Adrian Gallero ![]() TMS Support ![]() Joined: 18 May 2010 Posts: 1251 |
![]() ![]() ![]() ![]() |
|
Hi,
Thanks for the reporting this. Indeed you are right, there is no easy way to get the datatype of the value you are entering. But there is a simple workaround: Use a user-defined function. In the Generic Reports 2 demo you can add this class:
Then, add the line:
And in the template use: <#if(<#datatype(<#val>)>="datetime";<#format cell(longdate)>;)> I've tried it here and it works as expected. I am undecided yet if this would be a good thing to add directly to FlexCel or not; the main problem being that the datatypes are unlimited. (In this example I just report doubles and datetimes, but I won't report for example an int). But I'll see how we can make other cases like this simpler: At least we should change the Generic Reports 2 demo to include the UDF.
|
||
![]() |
Post Reply ![]() |
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |