iOS Question httpjob multiple query...

ivanomonti

Well-Known Member
Licensed User
how can I do with httpjob multiple requests without first canceling the second and so on


B4X:
Mod_Global.getJsonUrl2("Select * from user","0")
Mod_Global.getJsonUrl2("Select * from category","1")
Mod_Global.getJsonUrl2("Select * from Subcategory","2")
Mod_Global.getJsonUrl2("Select * from Post","3")

Sub getJsonUrl(parameter As String,jobname As String)
   Dim uid As HUD
   uid.ToastMessageShow("Load data",True)
   Dim s As String = parameter
   job1cli.Initialize(jobname,Me)
   job1cli.Download2(linkpage,Array As String("q",s,"command","null","debug","No"))
End Sub


Sub JobDone(Job As HttpJob)
   If Job.JobName = "0" Then jsonParseLogin(Job.GetString)
   If Job.JobName = "1" Then jsonParseCategory(Job.GetString)
   If Job.JobName = "2" Then jsonParseSubCategory(Job.GetString)
   If Job.JobName = "3" Then jsonParsePost(Job.GetString)
   If Job.JobName = "4" Then jsonParseRegole(Job.GetString)
End Sub


Private Sub jsonParseLogin(s As String)

   Log(s)
  
   If s.SubString2(0,1) = "0" Then
     Return
   End If
  
   uid.ProgressDialogHide
  
   Try
       Dim JSON As JSONParser
     JSON.Initialize(s)
     ListUser = JSON.NextArray
    
     If  ListUser.Size > 0 Then
    
       For Each colroot As Map In ListUser
         name = colroot.get("xxxxxxxxxxxxx")
         lastname = colroot.get("xxxxxxxxxxxxxx")
         numberphone = colroot.get("xxxxxxxxxxx")
         emailaddress = colroot.get("xxxxxxxxxxxxx")
         city = colroot.get("xxxxxxxxxxxxxx")
         password = colroot.get("xxxxxxxxxxxx")
         nik = colroot.get("nik")
         idphone = colroot.get("xxxxxxxxxx")
         hidephone = colroot.get("xxxxxxxxx")
         hidemail = colroot.get("xxxxxxxxxxx")
         hidecity = colroot.get("xxxxxxxxxxxxx")
         hidelocation = colroot.get("xxxxxxxxxxxxxx")
       Next
      
       register = True
      
     Else
    
     End If
   Catch
     register = False
     End Try
End Sub

Private Sub jsonParseCategory(s As String)

   Log(s)
  
   If s = "" Then
     Return
   End If
  
   If s.SubString2(0,1) = "0" Then
     Return
   End If
  
   Try
       Dim JSON As JSONParser
     JSON.Initialize(s)
     ListCategory = JSON.NextArray
   Catch
  
     End Try
  
End Sub

Private Sub jsonParseSubCategory(s As String)

   Log(s)
  
   If s = "" Then
     Return
   End If
  
   If s.SubString2(0,1) = "0" Then
     Return
   End If
  
   Try
       Dim JSON As JSONParser
     JSON.Initialize(s)
     ListSubCategory = JSON.NextArray
   Catch
  
     End Try
  
End Sub

Private Sub jsonParsePost(s As String)

   Log(s)
  
   If s = "" Then
     Return
   End If
  
   If s.SubString2(0,1) = "0" Then
     Return
   End If
  
   Try
       Dim JSON As JSONParser
     JSON.Initialize(s)
     ListData = JSON.NextArray
   Catch
  
     End Try
  
End Sub

Private Sub jsonParseRegole(s As String)

   Log(s)
  
   If s = "" Then
     Return
   End If
  
   If s.SubString2(0,1) = "0" Then
     Return
   End If
  
   Try
       Dim JSON As JSONParser
     JSON.Initialize(s)
     listRegole = JSON.NextArray
   Catch
  
     End Try
  
End Sub
 
Last edited:

antoponcho

Member
Licensed User
Dim parser As JSONParser

parser.initialize2(res.GetString)
Dim countries As List
countries.initialize
countries = parser.NextArray


It provokes a mistake. Since I can solve it?
 
Top