Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
convert datetime to string
HSMorales
Hi I am new to BIRT and am working on a report that uses a stored procedure for my dataset. One of the fields being returned "Date" is returned as a datetime field in the format "MMM dd, yyyy hh:mm AM". Another field being returned is a string field we'll call "Type". I need to create a computed column that is of string type. When the "Date" field is null, this field should equal "Type" else it should equal "Date" in the format MM/dd/yyyy. How can I accomplish this when one field is date and the other is string ?? Help would be greatly apprediated. Thanks
Find more posts tagged with
Comments
mwilliams
If you create a binding for this computed field, they'll all have to be of string type. For this, you can use .toString() on the date field to make it into a string. To get the desired format in your string, you may have to format the date in your script prior to making it into a string.
If you use a dynamic text box in your report to create and display your computed column, you'd be able to display a date or a string. The text box wouldn't care. Let me know if you have questions.
HSMorales
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85490" data-time="1321650406" data-date="18 November 2011 - 02:06 PM"><p>
If you create a binding for this computed field, they'll all have to be of string type. For this, you can use .toString() on the date field to make it into a string. To get the desired format in your string, you may have to format the date in your script prior to making it into a string.<br />
<br />
If you use a dynamic text box in your report to create and display your computed column, you'd be able to display a date or a string. The text box wouldn't care. Let me know if you have questions.<br /></p></blockquote>
<br />
<br />
<br />
<br />
<br />
Thanks, It worked for me.
mwilliams
No problem! Let us know whenever you have questions!