Generic dataset - date formating
Joined: 14 Oct 2019
Topic: Generic dataset - date formating
Posted: 14 Oct 2019 at 2:44pm
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).
Joined: 18 May 2010
|Post Options Quote Reply Posted: 18 Oct 2019 at 12:34pm|
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:
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.
|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