I am trying to create a table for defects and throughput number by hour while making it as parametererable (is that a word) than possible.
My specific question: how to i turn {this.props.data[0].Hour.value} into a something that gets the hour valuie of the row that I am concerned about?
Using expression is not the way. I don't know your final need but you might be interested in prop selected row data of the table.
Inside data you will find the row that changes everytime you select a row.
Not at work so I can't test it. but I do think it will work for my needs.
Here is the query I plan on running:
SELECT sum([Tape_Reject])
FROM [Ignition].[dbo].[Line1_Reject_LH]
Where datepart(hh,t_stamp) BETWEEN :myValueX and :myValueY
AND datepart(day,t_stamp) = day(getdate())
My valueX and myValueY are hours of a shift. In the end I want a table with 8 rows. First column will be the HOUR of the shift, so 1-8. Then I have a bunch of defect data like the Tape_Reject in the example above. I want to find a way that I can duplicate data[0} without having to change the hours manually.
That query will return only one column, the sum of Tape_Reject. There will be no hour value in your table.
Where are you seeing {this.props.data[0].Hour.value}
?
If you want to return an Hour column then your query would look something like,
SELECT
datepart(hh, t_stamp) AS 'Hour',
sum([Tape_Reject]) AS 'Tape Reject'
FROM [Ignition].[dbo].[Line1_Reject_LH]
WHERE datepart(hh,t_stamp) BETWEEN :myValueX AND :myValueY
AND datepart(day,t_stamp) = day(getdate())
GROUP BY Hour
I haven't tested this.
I want to find a way that I can duplicate data[0} without having to change the hours manually.
I still don't understand this sentence. Create a table of what you've got and what you want. Use the </> to apply preformatting to keep the columns lined up.
I guess I approched it all wrong. I created a table in perspective, and planned on having a query for each cell. My end goal is something like this:
Shift 1
Hour Parts Produced Defect 1 Defect 2
1 58 0 2
2 47 3 5
... ... ... ....
The hour 1 for shift 1 would be any parts and defects between 7am and 8am. The sql database regesters parts and defects as "1"s.
Is there a way to do that in SQL? That would blow my mind!!!
What do you mean the database registers defects as “1”s. Does that mean the column is a flag type where 1 = Defect
and 0 = Non-Defect
? Or does it mean something different?
Your query should return all data you want displayed in the table.
What I believe you are looking for is achieved with a modification to @Transistor’s query
SELECT
datepart(hh, t_stamp) AS 'Hour',
sum([Tape_Reject]) AS 'Tape Reject',
sum([Defect_1]) AS 'Defect 1',
sum([Defect_2]) AS 'Defect 2'
FROM [Ignition].[dbo].[Line1_Reject_LH]
WHERE datepart(hh,t_stamp) BETWEEN :myValueX AND :myValueY
AND datepart(day,t_stamp) = day(getdate())
GROUP BY Hour
It really depends on what your data looks like, I have no doubt though that what you want can be handled in SQL