Hello,
I have the following SQL statement
SELECT DATEADD(week, DATEDIFF(week, 0, homeworks_homeworks.submission_date), - 1) AS HwWeek, COUNT(homeworks_homeworks.homework_id) AS HwCounter, edu_subjects.subject_id, edu_subjects.subject_name
FROM homeworks_homeworks INNER JOIN
edu_subjects ON homeworks_homeworks.homework_subject_id = edu_subjects.subject_id
GROUP BY DATEADD(week, DATEDIFF(week, 0, homeworks_homeworks.submission_date), - 1), edu_subjects.subject_id, edu_subjects.subject_name
Where the results are shown like this
2019-01-13 00:00:00.000 1 1 Arabic
2019-01-13 00:00:00.000 1 2 English
2019-01-27 00:00:00.000 3 2 English
2019-02-03 00:00:00.000 3 2 English
When adding dynamic LineSeries as the following
if (_dsHwRep1.Tables.Count > 0)
{
int _tblCounter = _dsHwRep1.Tables[0].Rows.Count;
string _firstCol = "";
for(int x=0;x<_tblCounter;x++)
{
if(_firstCol != _dsHwRep1.Tables[0].Rows[x]["subject_name"].ToString())
{
_firstCol = _dsHwRep1.Tables[0].Rows[x]["subject_name"].ToString();
LineSeries _lSer = new LineSeries();
_lSer.Name = _firstCol;
_lSer.DataFieldY = "HwCounter";
HW_rep1.PlotArea.Series.Add(_lSer);
}
}
HW_rep1.DataSource = _dsHwRep1.Tables[0];
HW_rep1.DataBind();
}
The Chart binds correctly, but shows for example Arabic, 1 3 3 where it should just be 1 and not having the 3 values.
Any ideas?
Thank you