Android Question Http Jobs issue

sasidhar

Active Member
Licensed User
Longtime User
Hi,

can anyone help where the issue in the code wrt httpjobs.

from job2 multiple queries passed in loop. individually if a send query i am getting response,but in loop no response coming.

I am getting issue at job3 at response=htjob3.GetString

please let me know the issue.


sub globals()
Dim htjob1,htjob2,htjob3,htjob4,htjob5,htjob6,htjob7 As HttpJob
end sub

Sub JobDone (Job As HttpJob)
Try
Dim j As Int
Dim sq1 As String
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
Case "Job1"
'print the result to the logs
Dim parser As JSONParser
Dim response As String
Dim ssql As String


response=htjob1.GetString
parser.Initialize(response)
rows = parser.NextArray

'work with result
'rows is a List. Each item is a Map with the columns names as keys and the db values as the values.
If rows.Size > 0 Then

For i = 0 To rows.Size - 1
Log("Rows #" & i)
Dim m As Map
m = rows.Get(i)
'ToastMessageShow(rows.Size,False)
Dim tCursor2 As Cursor
Dim ppsql1 As String
Dim unit_id As String
usrid= m.Get("USID")
htjob2.Initialize("Job2", Me)
ppsql1="select * from vehicle_config where usid=" & usrid
htjob2.PostString(ServerUrl1,ppsql1)
Next
'("Sync Completed.." , 15, 75, 50, "", Colors.Yellow, Colors.Green, 15, True)
Else
'ToastMessageShow("No data missing Found..", True)
'MyT.ToastMessageShow2("No data missing Found.." , 15, 75, 50, "", Colors.Yellow, Colors.Green, 15, True)
End If

ToastMessageShow("Sucess", True)


Case "Job2"
' ToastMessageShow("Sync Start",True)
'MyT.ToastMessageShow2("Sync Start.." , 15, 75, 50, "", Colors.Yellow, Colors.Green, 15, True)
Dim parser As JSONParser
Dim response As String
Dim ssql As String

response=htjob2.GetString
parser.Initialize(response)
rows = parser.NextArray

'work with result
'rows is a List. Each item is a Map with the columns names as keys and the db values as the values.
If rows.Size > 0 Then

For i = 0 To rows.Size - 1
'Log("Rows #" & i)
Dim m As Map
m = rows.Get(i)
'ToastMessageShow(rows.Size,False)
Dim tCursor2 As Cursor
Dim ppsql1 As String
Dim unit As String
unit= m.Get("UNIT_ID")
htjob3.Initialize("Job3", Me)
ppsql1="Select top 1 * from new_pointware where unit_id= " & "'" & unit & "' order by local_date_time desc"
htjob3.PostString(ServerUrl1,ppsql1)

Next

'("Sync Completed.." , 15, 75, 50, "", Colors.Yellow, Colors.Green, 15, True)
Else
'ToastMessageShow("No data missing Found..", True)
'MyT.ToastMessageShow2("No data missing Found.." , 15, 75, 50, "", Colors.Yellow, Colors.Green, 15, True)

End If

Case "Job3"
Dim parser As JSONParser
Dim response As String
Dim ssql As String

response=htjob3.GetString
parser.Initialize(response)
rows = parser.NextArray
Msgbox(response,"alert")

'work with result
'rows is a List. Each item is a Map with the columns names as keys and the db values as the values.
If rows.Size > 0 Then

For i = 0 To rows.Size - 1
Log("Rows #" & i)
Dim m As Map
m = rows.Get(i)
'ToastMessageShow(rows.Size,False)
Dim tCursor2 As Cursor
Dim ppsql As String
Dim unit_id As String
Dim pparam1,pparam2,pparam3,pparam4,pparam5,pparam6,pparam7,pparam8,pparam9,pparam10,pparam11,pparam12,pparam13 As String
unit_id= m.Get("UNIT_ID")
pparam1=m.Get("LAT")
pparam2=m.Get("LON")
pparam3=m.Get("SPEED")
pparam4=m.Get("SERVER_TIME")

MarkerOptions.Initialize
MarkerOptions.Position2(pparam1, pparam2).Snippet("Speed:" & pparam3 & " Date:" & pparam4).Title(unit_id).Visible(True)
BitmapDescriptor=BitmapDescriptorFactory.FromAsset("green1.png")
MarkerOptions.Icon(BitmapDescriptor)
'Marker(i) =GoogleMapsExtras.AddMarker(gmap, MarkerOptions)

Next
'("Sync Completed.." , 15, 75, 50, "", Colors.Yellow, Colors.Green, 15, True)
'CameraPosition1.Initialize(pparam1, pparam2, 15)
'gmap.AnimateCamera(CameraPosition1)
Else
'ToastMessageShow("No data missing Found..", True)
'MyT.ToastMessageShow2("No data missing Found.." , 15, 75, 50, "", Colors.Yellow, Colors.Green, 15, True)

End If

Case "Job4"

Case "Job5"

Case "Job6"
'print the result to the logs
ToastMessageShow("Sucess", True)
End Select
Else
' Log("Error: " & Job.ErrorMessage)
' Msgbox("Error: " & Job.ErrorMessage,"error")
ToastMessageShow("Error@Jobs..", True)
'MyT.ToastMessageShow2("Error@Jobs.." , 15, 75, 50, "", Colors.Yellow, Colors.red, 15, True)


End If
Job.Release
Catch
Msgbox(LastException.Message,"alert")

End Try
End Sub


thanks
sasidhar
 

sasidhar

Active Member
Licensed User
Longtime User
Hi Don,

thanks for quick response. please find the attached code(zip file). please help to resolve the issue.

thanks
sasidhar.M
 

Attachments

  • code.zip
    327 KB · Views: 146
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…