Author |
Message |
nhopp4
Groupie
Joined: 03 Oct 2012
Location: United States
Online Status: Offline
Posts: 62
|
Topic: Subreport Timestamp Posted: 06 May 2013 at 6:05am |
Hi guys,
I am having an issue with a subreport that is pulling a parameter from the main report for a date range. When I run the report I show what I want but it also includes all dates going back months in my subreport. I would like it to only show about an hour before the time that the main report shows on my subreport.
My timestamp is in datetime format.
Any ideas how I can do this?
Thanks,
Nick
|
IP Logged |
|
Sastry
Moderator
Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
|
Posted: 06 May 2013 at 7:19am |
Hi
Is this sub report linked to main report ? if so, are you passing parameter value to sub report or linking it with sub report date field ?
Check sub report record selection formula for datetime parameter criteria.
In which section of your main report you placed your sub report.
|
Thanks,
Sastry
|
IP Logged |
|
nhopp4
Groupie
Joined: 03 Oct 2012
Location: United States
Online Status: Offline
Posts: 62
|
Posted: 06 May 2013 at 8:03am |
The subreport is linked to the main report through a parameter that looks at the timestamp for its data.
In the subreport record selection the datetime is equal to the datetime parameter.
I placed the subreport on details 1 section of the main report.
Thanks for the reply,
Nick
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
Posted: 06 May 2013 at 8:42am |
i will assume since you are running this sub report on the detail section that you are also linking it on some other primary key field so that only data relevant to that detail would appear.
as for the time you can alter the select criteria in the sub report to use a dateadd function, something like
{table.datefield}>=dateadd('h',-1,{?pm-datetime})
|
IP Logged |
|
nhopp4
Groupie
Joined: 03 Oct 2012
Location: United States
Online Status: Offline
Posts: 62
|
Posted: 06 May 2013 at 10:11am |
DBlank,
That was what I was trying to do but couldnt figure out how to structure it. When I put in the line in the record selection for the Subreport that you gave me it says that a date is required where my timestamp parameter is.
{Reports_Events.Timestamp}>=dateadd('h',-1,{?Pm-Reports_Events.Timestamp})
Thanks for the reply!
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
Posted: 06 May 2013 at 10:16am |
check sub report and verify that the param ?Pm-Reports_Events.Timestamp is an actual datetime field type. I have seen some DB's insert datetime stamps as strings/varchar data types.
if it is a string convert it...
{Reports_Events.Timestamp}>=dateadd('h',-1,datetime({?Pm-Reports_Events.Timestamp}))
|
IP Logged |
|
nhopp4
Groupie
Joined: 03 Oct 2012
Location: United States
Online Status: Offline
Posts: 62
|
Posted: 07 May 2013 at 2:32am |
I double checked and the parameter is a date time field in the subreport.
|
IP Logged |
|
nhopp4
Groupie
Joined: 03 Oct 2012
Location: United States
Online Status: Offline
Posts: 62
|
Posted: 07 May 2013 at 6:05am |
Not sure what I changed to make this work but the code works but still not getting what I need.
{Reports_Events.Timestamp}>=dateadd('h',-1,{?Pm-Reports_Events.Timestamp})
When I put this in it gives me any dates above my main report timestamp not just an hour which is all I want. I want the dates lower than the main report date by an hour. So if the date was 4/1/2013 1:00:00 PM I only want to see 4/1/2013 1200pm - 1:00pm.
Thanks for your help guys I think we are close just need to only see an hour instead of every timestamp before or after the date.
|
IP Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
Posted: 07 May 2013 at 7:19am |
{Reports_Events.Timestamp} in dateadd('h',-1,{?Pm-Reports_Events.Timestamp}) to {?Pm-Reports_Events.Timestamp}
|
IP Logged |
|
nhopp4
Groupie
Joined: 03 Oct 2012
Location: United States
Online Status: Offline
Posts: 62
|
Posted: 07 May 2013 at 8:47am |
That worked! Thanks a lot DBlank! If you have time how would I make it to also include 15 minutes after if I wanted?
Thanks!!!
Nick
|
IP Logged |
|
|