iOS Question xCustomListView Help

marconotsopolo

Member
Licensed User
Longtime User
I have been struggling to sort my data into one panel if the data is related. I have a timesheet with 7 days (see image), I have several months worth of employee data (total minutes worked) and I want to populate each day with the relevant data from that date range. example;

EmployeeID Name WeekNo Range
8000 John Doe 18 02-05-2022 - 08-05-2022

Mon Tue Wed Thu Fri Sat Sun
2.5 2.3 2.2 2.5 2.5 2.1 0

EmployeeID Name WeekNo Range
8000 John Doe 19 09-05-2022 - 15-05-2022

Mon Tue Wed Thu Fri Sat Sun
2.5 2.5 2.3 2.2 2.1 0 0

etc..

I have the data sorted by week numbers and employee ID, I am using the example from @Erel https://www.b4x.com/android/forum/threads/b4x-b4xpages-sql-xclv-example.131888/ and the data appears as you would expect in separate panels (see image). I have used a select case statement to get the data into the right day but in each separate panel, what I would like to do is insert the data into just the one panel for that date range.

CreateRecordData:
Public Sub CreateRecordData (EmpID As Int, EmpName As String, eIN As String, eOUT As String, eSiteID As Int, eScannedSiteID As Int, eTotalMins As Double, WeekNo As Int) As RecordData
    Dim t1 As RecordData
    t1.Initialize
    Log("TimeIN: " & eIN)    
    t1.EmpID = EmpID
    t1.EmpName = EmpName
    t1.eIN = eIN
    t1.eOUT = eOUT
    t1.eSiteID = eSiteID
    t1.eScannedSiteID = eScannedSiteID    
    t1.eTotalMins = eTotalMins
    t1.eWeekNo = WeekNo
    Return t1
End Sub

Private Sub CreateItem(rd As RecordData) As B4XView
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, Root.Width, 200dip)
    p.LoadLayout("lyEmpTimesheet")
    'labels will point to the last loaded views with the set name.
    lbEmpID.Text = rd.EmpID
    lbEmpName.Text = rd.EmpName
    lbSiteID.Text = rd.eScannedSiteID
    lbDateRange.Text = rd.eIN
    Log("TimeIN: " & rd.eIN)
    DateTime.DateFormat = "dd/mm/yyyy HH:mm"    
    
    Select Case dayNumber
        Case 1
            txtSunAct.Text = toHoursAndMinutes(rd.eTotalMins)
        Case 2
            txtMonAct.Text = toHoursAndMinutes(rd.eTotalMins)
        Case 3
            txtTueAct.Text = toHoursAndMinutes(rd.eTotalMins)
        Case 4
            txtWedAct.Text = toHoursAndMinutes(rd.eTotalMins)
        Case 5
            txtThuAct.Text = toHoursAndMinutes(rd.eTotalMins)
        Case 6
            txtFriAct.Text = toHoursAndMinutes(rd.eTotalMins)
        Case 7
            txtSatAct.Text = toHoursAndMinutes(rd.eTotalMins)
    End Select
    Return p
End Sub
End Sub

I am unable to change the date formats unfortunately as this info is coming from an outside source and this is how they are sent, but the conversion I use works just fine for now.
Timesheet1.jpg


Any help in getting the data to insert into the same line for that date range would be great. I have the data stored as a recordset and I have put all data into a MAP to see which would help me achieve my goal, but stuck on grouping into the one panel for now.

Many thanks
 
Top