JonnyCav
Member
The code is below but the issue is simple to explain:
A layout loads the data (db search query) with an option (button) to change the date/period.
When the button is clicked, a variable changes and SHOULD reload the search query.
This all works perfectly well (I have 'Log' info that verifies this) BUT instead of a new, refreshed panel it just adds the new records.
I've tried all I can find such as pa.RemoveAll...etc. but whilst the record wasn't visible any longer, the panel kept getting longer.
Please someone point me in the right direction.
WHEN THE RELOAD BUTTON IS PRESSED it loads this code (taking the new variable). This all works fine.
A layout loads the data (db search query) with an option (button) to change the date/period.
When the button is clicked, a variable changes and SHOULD reload the search query.
This all works perfectly well (I have 'Log' info that verifies this) BUT instead of a new, refreshed panel it just adds the new records.
I've tried all I can find such as pa.RemoveAll...etc. but whilst the record wasn't visible any longer, the panel kept getting longer.
Please someone point me in the right direction.
SCREEN:
Private Sub Load_Scores
'INITALLY USING TODAY'S DATE AS DEFAULT
Log(period)
rs=Starter.sql.ExecQuery2 _
("SELECT studentId, studentName FROM Attendance WHERE groupName =? AND classPeriod=?" _
,Array As String(selectedGroup,period))
Do While rs.NextRow
Dim pa As B4XView = xui.CreatePanel("")
pa.LoadLayout("ListOfStudentsScores")
pa.SetLayoutAnimated(0,0,0,clvAttendance.AsView.Width,60dip)
lblScores1.Text = rs.GetString("studentID")
lblScores2.Text = rs.GetString("studentName")
clvAttendance.Add(pa,"")
Loop
rs.Close
End Sub
WHEN THE RELOAD BUTTON IS PRESSED it loads this code (taking the new variable). This all works fine.
B4X:
Private Sub btnReloadScores_Click
'IF A CHANGE IS MADE TO THE DEFAULT, THIS STORES THE (DATE) PERIOD AND THEN RELOADS
'THE DATABASE SEARCH RESULTS
period=txtClassPeriod.Text
Load_Scores
End Sub