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)
Date parameter Need to use as date and convert to number for 2 different data Sources
system_migrated
One data source stores date in date format and the other stores date as number. How do I prevent the user from entering the date twice for the different formats?
Find more posts tagged with
Comments
mwilliams
Hi tfield,
You could convert the user's entered value, whether a date or number, in the script of the dataSet to the other format before using it to limit the dataSet.
Migrateduser
Michael,
I'm quite new to BIRT. Adding scripting to the mix has me at a little lost. I never know when to add import java...could you possible give me an example of converting a date to a number in the script format.
Thanks,
Tina
mwilliams
Tina,
What format is your date in when it's a number? Is it an epoch date? Or just the date like MMddyyyy as an integer?
Migrateduser
Michael,
Thanks for your reply. My integer date format is yyyymmdd. I'm pulling this particular date in from an as/400.
Thanks,
Tina
mwilliams
Tina,
Sorry, I should have asked what version of BIRT you were using too! My mistake. Let me know. I'll make an example that takes in an integer value of date 'yyyyMMdd' from the user and queries the sample database for a date field using script.
Migrateduser
Michael,
Thanks for your help. I'm using birt 2.5.2
Tina
mwilliams
Tina,<br />
<br />
Take a look at this report I posted in the devShare. It should help you out.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/1218-convert-integer-date-to-date-sample-report/#description'>Convert
Integer Date to Date Sample Report - Tips & Tricks - BIRT Exchange</a>
Migrateduser
Michael,
You're awesome! Thanks so much. It's working perfectly. I've been able to eliminate 2 completely unnecessary (duplicate) parameters.
Tina
mwilliams
Excellent! Glad to help. Let us know whenever you have questions!
Migrateduser
Michael,
I do have one more question. Is there a limit to the amount of characters in the script that I am using?
I have a pretty long case statement, which I in turn group by and then sort by. This portion needs to go in the script because it's after the "where" statement.
It doesn't seem like a filter or sort would help in this case due to the wording of the case statement. When I take off the sort by, everything works, but not in proper order.
select StatusCode,
case when StatusCode ='RU' then 'Returned Undeliverable'
when StatusCode ='NR' then 'No Response'
else 'Questionaires Received' end as Status,
count(JurorID)
from Jurors
where OriginalSummsDate between newDate and newDate2
Group by case when StatusCode ='RU' then 'Returned Undeliverable'
when StatusCode ='NR' then 'No Response'
else 'Questionaires Received' end
Order by case when StatusCode ='RU' then 1
when StatusCode ='NR' then 2
else 3 end
Thanks,
Tina
mwilliams
Tina,
No, there shouldn't be a limit. What error are you getting?