Hi All,
I tried calling a httpjob inside a job (ie requesting data from server job3 and sending relevant data from mobile local db job4).
Issue is when i get response of 20 strings from job3 httpjob request from server, i could send only few strings say 8 out of 20 from httpjob4), I get no error, job4 sucess message i get in between before completing all strings(ie 20) and stops, this is implemented as service.
Pls find the code below..this works well but not all data from request could not send..pls help to resolve this issue..
Thx
Sasidhar.M
Sub JobDone (Job As HttpJob)
Try
dim ssql 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
ToastMessageShow("Sucess", True)
Case "Job2"
ToastMessageShow("Sucess", True)
Case "Job3"
ToastMessageShow("Sync Start",True)
Dim parser As JSONParser
Dim response As String
'response = HttpUtils.GetString(ServerUrl)
'response = htjob3.GetString2(ServerUrl)
response=htjob3.GetString
parser.Initialize(response)
Dim rows As List
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(m.Get("seqNo") & " , " & m.Get("SeqDate") ,True)
dim tCursor2 as cursor
ssql="SELECT * FROM data_table where param8= " & "'" & aIME1 & "'"
tCursor2 = ssql1.ExecQuery(ssql)
If tCursor2.RowCount>0 Then
tCursor2.Position = i
dim pparam1,pparam2,pparam3,pparam4,pparam5,pparam6,pparam7,pparam8,pparam9,pparam10,pparam11,pparam12 as string
dim ss as string
dim htjob4 as HttpJob
htjob4.Initialize("Job4", Me)
pparam1=(tCursor2.GetString("param1"))
pparam2=(tCursor2.GetString("param2"))
pparam3=(tCursor2.GetString("param3"))
pparam4=(tCursor2.GetString("param4"))
pparam5=(tCursor2.GetString("param5"))
pparam6=(tCursor2.GetString("param6"))
pparam7=(tCursor2.GetString("param7"))
pparam8=(tCursor2.GetString("param8"))
pparam9=(tCursor2.GetString("param9"))
pparam10=(tCursor2.GetString("param10"))
pparam11=(tCursor2.GetString("param11"))
pparam12=(tCursor2.GetString("param12"))
ss= ServerUrl & "param1=" & pparam1 & "¶m2=" & pparam2 & "¶m3=" & pparam3 & "¶m4=" & pparam4 & "¶m5=" & pparam5 & "¶m6=" & pparam6 & "¶m7=" & pparam7 & "¶m8=" & pparam8 & "¶m9=" & pparam9 & "¶m10=" & pparam10 & "¶m11=" & pparam11 & "¶m12=" & pparam12
htjob4.PostString(ss,"")
end if
tCursor2.close
ToastMessageShow("Data posting From Mobile2Server InProgress.." & i & " of " & rows.Size, True)
Next
Else
ToastMessageShow("No data Found" ,True)
End If
Case "Job4"
'print the result to the logs
ToastMessageShow("Data posting Complete", True)
Case "Job5"
'print the result to the logs
ToastMessageShow("Sucess", True)
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" , True)
End If
Job.Release
Catch
Log(LastException.Message)
End Try
End Sub
I tried calling a httpjob inside a job (ie requesting data from server job3 and sending relevant data from mobile local db job4).
Issue is when i get response of 20 strings from job3 httpjob request from server, i could send only few strings say 8 out of 20 from httpjob4), I get no error, job4 sucess message i get in between before completing all strings(ie 20) and stops, this is implemented as service.
Pls find the code below..this works well but not all data from request could not send..pls help to resolve this issue..
Thx
Sasidhar.M
Sub JobDone (Job As HttpJob)
Try
dim ssql 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
ToastMessageShow("Sucess", True)
Case "Job2"
ToastMessageShow("Sucess", True)
Case "Job3"
ToastMessageShow("Sync Start",True)
Dim parser As JSONParser
Dim response As String
'response = HttpUtils.GetString(ServerUrl)
'response = htjob3.GetString2(ServerUrl)
response=htjob3.GetString
parser.Initialize(response)
Dim rows As List
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(m.Get("seqNo") & " , " & m.Get("SeqDate") ,True)
dim tCursor2 as cursor
ssql="SELECT * FROM data_table where param8= " & "'" & aIME1 & "'"
tCursor2 = ssql1.ExecQuery(ssql)
If tCursor2.RowCount>0 Then
tCursor2.Position = i
dim pparam1,pparam2,pparam3,pparam4,pparam5,pparam6,pparam7,pparam8,pparam9,pparam10,pparam11,pparam12 as string
dim ss as string
dim htjob4 as HttpJob
htjob4.Initialize("Job4", Me)
pparam1=(tCursor2.GetString("param1"))
pparam2=(tCursor2.GetString("param2"))
pparam3=(tCursor2.GetString("param3"))
pparam4=(tCursor2.GetString("param4"))
pparam5=(tCursor2.GetString("param5"))
pparam6=(tCursor2.GetString("param6"))
pparam7=(tCursor2.GetString("param7"))
pparam8=(tCursor2.GetString("param8"))
pparam9=(tCursor2.GetString("param9"))
pparam10=(tCursor2.GetString("param10"))
pparam11=(tCursor2.GetString("param11"))
pparam12=(tCursor2.GetString("param12"))
ss= ServerUrl & "param1=" & pparam1 & "¶m2=" & pparam2 & "¶m3=" & pparam3 & "¶m4=" & pparam4 & "¶m5=" & pparam5 & "¶m6=" & pparam6 & "¶m7=" & pparam7 & "¶m8=" & pparam8 & "¶m9=" & pparam9 & "¶m10=" & pparam10 & "¶m11=" & pparam11 & "¶m12=" & pparam12
htjob4.PostString(ss,"")
end if
tCursor2.close
ToastMessageShow("Data posting From Mobile2Server InProgress.." & i & " of " & rows.Size, True)
Next
Else
ToastMessageShow("No data Found" ,True)
End If
Case "Job4"
'print the result to the logs
ToastMessageShow("Data posting Complete", True)
Case "Job5"
'print the result to the logs
ToastMessageShow("Sucess", True)
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" , True)
End If
Job.Release
Catch
Log(LastException.Message)
End Try
End Sub