Android Question How to sum numbers in CLV

PumaCyan

Member
Licensed User
how do i add up the numbers in the total from the start line to the end?

B4X:
Sub List_Rekap(DB As String)
    Dim req As DBRequestManager = CreateRequest(DB)
    Dim dbcmd As DBCommand = CreateCommand("list_rekap", Null)
    Wait For (req.ExecuteQuery(dbcmd, 0, Null)) JobDone(j As HttpJob)
    '
    If j.Success Then
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result(res As DBResult)
        '
        CLV1.Clear
        CLV1.DefaultTextColor = xui.Color_Black
        For Each row() As Object In res.Rows
            Dim dblTotal as Double
            Dim cd As MyTypeData
            '
            cd.tanggal = row(0)
            cd.total = row(2)
            '
            CLV1.AddTextItem(CS.Initialize.Typeface(Typeface.DEFAULT_BOLD).Append("Tanggal  : " & cd.tanggal).Pop.Size(13).Append(CRLF & "Total         :  " & MyFormat.MyCurrency(cd.total)).PopAll, cd.tanggal)
            '
            Log(cd.totalnet)
            '
            dblTotal = dblTotal + cd.totalnet
        Next
        '
        lblTotal.Text = "Rp. " & dblTotal
        '
        If CLV1.Size = 0 Then
            '
            xui.MsgboxAsync("Data tidak ditemukan, silahkan cek kembali...", "Informasi")
            Wait For Msgbox_Result (Result As Int)
            If Result=xui.DialogResponse_Positive Then
                lblStatus.Visible = True
                lblStatus.Text = "Data tidak tersedia"
                Return
            End If
            '
        Else
            lblStatus.Visible = False
        End If
    Else
        xui.MsgboxAsync("Gagal memuat detail data...", "Kesalahan")
        Wait For Msgbox_Result (Result As Int)
        If Result=xui.DialogResponse_Positive Then
            B4XPages.ClosePage(Me)
        End If
    End If
    j.Release
End Sub
 

Attachments

  • Screenshot_2023-04-17-14-50-13.png
    Screenshot_2023-04-17-14-50-13.png
    91.3 KB · Views: 67
Last edited:
Top