Reporting Module Date data type

I am trying to run a basic SQl query in the reporting module but the data type Date for the start and stop times is producing a string for the date. Is there a way to get a DateTime date type on these parameters?

Maybe show us how you are assigning values to your parameters and the query?

If you are using something like the date time input then the value property should be a datetime, but if you are using the formatted value property that will be interpreted as a string.

You also have options in the query to convert to a date time, something like this as an example:
CONVERT(DATETIME, ?, 120)

This is my query.
SELECT BPR_B40DieNum,
BPR_B40BilletTotal,
avg(BPR_B40ExtrudeTime) AS ‘Average_ExtTime’,
avg(BPR_R2R_Active) AS ‘Average_R2R’,
avg(BPR_R2R_Active) / avg(BPR_B40ExtrudeTime) AS ‘R2R_Percent’
FROM Epics.foy.SCM_DW_Boss_Billet2
WHERE EventTime >= convert(DateTime,{[default]Reports/Reports_12HrStartTime.value},120) AND EventTime <= convert(DateTime,{[default]Reports/ReportsStopTime.value},120) AND BPR_B40BilletCount > 3 AND
BPR_B40ExtrudeTime <= 299 AND Bpr_B40BilletCount < Bpr_B40BilletTotal
GROUP BY BPR_B40DieNum,
Bpr_B40BilletTotal

this has the convert option that you suggested in it as well. The tag values are from two expression tags with data type DateTime, StopTime expression of now() and the start date uses a dateArithmetic of -24 “hr” from the stop time.

Next time use the preformatted text button </> for better readability. Ok, so you aren’t using parameters at all (those are denoted by “?” in your query). I don’t see a reason that wouldn’t work, though you don’t need two tags. You can just use the stop tag and do date arithmetic in the query.
Something like this:

DATEADD(hour, -24, StopTime)

You should probably parameterize theses. An example Note the question marks in the query, with the parateres at the bottom of the :
image
image

That did it!! Thank you very much Jordan.

1 Like