Home
Analytics
Formatting of number and date in BIRT report
Tuco
Hi,
I have created a BIRT report in which i am showing the phone number, which is a String with value like 1234567890. But it is being formatted to 1,234,567,890.
I tried looking but somehow cannot find out the option to show it as a String.
Also, i have a few dates which are formatted as yyyy-mm-dd but i want to format them as "mm-dd-yyyy".
I think while exploring it, i saw the option to format various datatypes but cannot seem to find it now.
Can BIRT gurus help me out?
Thanks
Tuco
Find more posts tagged with
Comments
Yaytay
<blockquote class='ipsBlockquote' data-author="'Tuco'" data-cid="92877" data-time="1325201550" data-date="29 December 2011 - 04:32 PM"><p>
I have created a BIRT report in which i am showing the phone number, which is a String with value like 1234567890. But it is being formatted to 1,234,567,890. <br /></p></blockquote>
<br />
This is best handled by making the data type of the column a string in the first place, telephone numbers don't work very well as numbers because all number formats either strip leading zeroes or have a fixed number of places (both of which are wrong for telephone numbers).<br />
If your column is a number in the datasource then I recommend converting it in the query. If the data source is a flat file then I recommend changing the mapping for that column so it is text, not a number.<br />
<br />
Note that BIRT records the type of a column in quite a few places and it isn't very good at updating them all when a column gets changed - to the extent that it's often simplest to drop the dataset and recreate it rather than go through all the layers making sure that the data type is correct.<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'Tuco'" data-cid="92877" data-time="1325201550" data-date="29 December 2011 - 04:32 PM"><p>
Also, i have a few dates which are formatted as yyyy-mm-dd but i want to format them as "mm-dd-yyyy". <br /></p></blockquote>
Again this depends on the type of the data that BIRT is receiving - if the data column is a string formatted as yyyy-mm-dd then BIRT cannot apply any data formats to it because it doesn't recognise it as a date.<br />
If BIRT does consider the column to be a date then you should be able to change the format in the Properties editor under "Format DateTime" - the value you want isn't in the default list so you'll have to choose custom and specify it.<br />
<br />
I'd be very hesitant about using the format you've chosen, usually dashed date formats are ISO dates (yyyy-mm-dd), having a different dashed format may cause confusion (the usual US format would be mm/dd/yyyy).
Tuco
Thank you..I was able to fix that.