Hello all,
Crystal Reports version: 10.0.0.533
Data is stored in iHistorian Tables: "ihRawData"
Driver connecting Crystal to iHistorian = "iHistorian OLE DB Provider"
I currently have a Main Report with one Sub Report attached.
How the Process will work: The only parameter a user enters is a Batch_ID number.
In the Main report I have a Command Object which takes this Batch_ID in and prints out at the top of the main report these:?Batch_ID, Cycle_Start_Time, and Cycle_End_Time.
In the Sub Report I have a Command Object Which has two Parameters ?start_dtime and ?end_dtime which are linked to the Main Report's Cycle_Start_Time and Cycle_End_Time.
The Subreport i meant to take in the Main Report's Start and End Time then prints out the Min Temp and Max Temp for 5 Temperature Indicators within that ?start_dtime and ?end_dtime.
The Main Report's command object works great.
Main Report Command Object's SQL Query:
SELECT tagname, value, Min(timestamp) as Starttime, Max(timestamp) as Endtime
FROM ihRawData
WHERE tagname LIKE "*Tank_0047*"
AND Value = {?BatchID}
AND value != 0
AND timestamp BETWEEN yesterday-7 day AND today
AND intervalmilliseconds = 60000
AND samplingmode = interpolated
GROUP BY tagname, value
Here's an example of what is printed out at the top of the main report:
Batch ID: test0004 Cycle Start Time:6/17/2013 2:15:00PM
Cycle End Time: 6/17/2013 3:33:00PM
VVVVVProblemVVVVV
The sub report seem's to be where the issue lies (maybe).
Sub Report Command Object's SQL Query:
SELECT tagname, Min(value) as Mintemp, Max(value) as Maxtemp
FROM ihRawData
WHERE tagname LIKE "*Tank_0047*TI_TANK_0047_01*"
or tagname LIKE "*Tank_0047*TI_TANK_0047_02*"
or tagname LIKE "*Tank_0047*TI_TANK_0047_03*"
or tagname LIKE "*Tank_0047*TI_TANK_0047_04*"
or tagname LIKE "*Tank_0047*TI_TANK_0047_05*"
AND value != 0
AND timestamp BETWEEN {?start_dtime} AND {?end_dtime}
AND intervalmilliseconds = 60000
GROUP BY tagname
ORDER BY tagname
Good Sub Report: The sub Reports query prints everything out perfectly if I DO NOT use the 2 parameters,i.e. replacing {?start_dtime} with "6/17/2013 03:15:00" AND replacing {?end_dtime} with "6/17/2013 06:15:00".
Good sub Report Printout Example:(These aren't actual values, they are to give you a visual)
Tagname Min Temp Max Temp
------- -------- --------
Tank_0047_TI_TANK_0047_01 21.33424234 27.55434534
Tank_0047_TI_TANK_0047_02 26.33424234 27.63424234
Tank_0047_TI_TANK_0047_03 24.33424234 27.43424234
Tank_0047_TI_TANK_0047_04 22.33424234 27.33424234
Tank_0047_TI_TANK_0047_05 23.33424234 27.53424234
Bad Sub Report: But, using the 2 Subreport parameters, it only prints out the first Temperature indicator with it's TempMin and TempMax with a timeframe between always within the last two hours. I.e. if I refreash the bad report the MinTemp and MaxTemp will change.
Bad sub Report Printout Example:(These aren't actual values, they are to give you a visual)
Tagname Min Temp Max Temp
------- -------- --------
Tank_0047_TI_TANK_0047_01 21.33424234 27.55434534
Now, hardcoding the Timestamps in the Subreport query and getting a correct report is nice, but I need the timestamps to be based off of the Main report, and not be hardcoded.
Also, In the subreport, I have dragged the Parameters:"{?start_dtime} AND {?end_dtime}" onto the report design view and looked at them in a print view to make sure the links to the Main Report's start/end time are both functioning. Both parameters work and had the correct time.
Any Ideas?
I'd appreciate any *help*.
Thanks