Android Question How to refresh httpjob or clear httpjob

Makumbi

Well-Known Member
Licensed User
Please help iam trying to loop through my table with account numbers 05-05586 and 05-07156 but the problem is when i check log from the j.gestring it still holds the old inform yet i wanted it to have the new json inform from the account i have tried to use the release feature but it is not clearing the old log please help

B4X:
[{"Account":"05-07152","balance":373000,"class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","autofield":7165}]
B4X:
(JSONTokener)  at character 0 of [{"Account":"05-05586","balance":808000,"class":"S6","Stream":"A","Names":"NAMIGADDE DEBORAH","autofield":5586}]


B4X:
Dim l As Long
    DateTime.DateFormat = "dd/MM/yyyy" ' "1961-08-29"
    Dim datestring As String = DateTime.Date(JsonDateToTick(DateTime.Now))
    l = DateTime.DateParse(datestring)
    DateTime.DateFormat = "dd/MM/yyyy"
    'Log(DateTime.Date(l))
    Froms.Text = DateTime.Date(l)
    'Log(DateTime.Date(JsonDateToTick( quot.Get("Tos"))))
    Dim lt As Long
    DateTime.DateFormat = "dd/MM/yyyy" ' "1961-08-29"
    Dim datestring As String = DateTime.Date(JsonDateToTick( DateTime.Now))
    lt = DateTime.DateParse(datestring)
    DateTime.DateFormat = "dd/MM/yyyy"
    'Log(DateTime.Date(lt))
    Tos.Text = DateTime.Date(lt)
    cursor1 = Starter.SQL1.ExecQuery("SELECT ID,Account FROM Allacounts")
        If cursor1.RowCount > 0 Then
                For i = 0 To cursor1.RowCount - 1
                    cursor1.Position = i
                
                    Dim NewID As Int
                    NewID = cursor1.GetInt("ID")
                
            
    '    NewID = NewID +1
        Dim acts As String=""
        Dim acts As String = cursor1.Getstring("Account")
            
        Dim jt As HttpJob
                jt.Initialize("", Me)
        jt.Download("http://192.168.1.239/Generic_Handler_JSON/HandlerVBSinglestatment.ashx?customerId=" & acts & "&Froms=" & Froms.Text & "&Tos=" & Tos.Text)
    
            Dim j As HttpJob
            'j.Release
            j.Initialize("", Me)
            j.Download("http://192.168.1.239/Generic_Handler_JSON/HandlerVBBalance.ashx?customerid=" & acts)
            j.GetRequest.Timeout = 30000 ' 10 seconds
            Wait For (j) JobDone(j As HttpJob)
            If j.Success Then ' if job is success (http status code 200)
                Dim RetVal As String
                RetVal = j.GetString
        
                Dim jp As JSONParser
                jp.Initialize(j.GetString)
                Log(jp) ' will pr
                Dim quotes As List = jp.NextArray
                For Each quot As Map In quotes
                    Log("Account: " & quot.Get("Account"))
                    Log("Amount: " & quot.Get("balance"))
                    Log("Class: " & quot.Get("class"))
                    Log("Stream: " & quot.Get("Stream"))
                    Log("Names: " & quot.Get("Names"))
                    Log("autofield: " & quot.Get("autofield"))
                    
                    If quot.Get("Account")=acts Then
                    Starter.SQL1.ExecNonQuery("INSERT INTO Balances VALUES('" & quot.Get("Account") & "','" & quot.Get("Names") & "','" & quot.Get("class") & "','" & quot.Get("Stream")  & "','" & quot.Get("balance") & "','" & quot.Get("autofield") & "')")
                    j.Release
                    jt.Release
                    Else
                    
                        End If
                Next
            Else
                Msgbox("Records Not Processed. Please check Internet Connectivity and Try Try Again ","No Records Returned")
                Return
            End If
    
    
    
                
        Next
    
        
        Msgbox("Records Processed Successfully. You Can Now Check ","SMIS")
        
        Log(RetVal) ' will print in log value returned from the server
        j.Release
        Return
 
Top