iOS Question Httpjob in a loop

josnav

Member
Licensed User
Longtime User
Hi, I launch a httpjob, then inside it (Jobdone), I call a function that calls httpjob in a loop, and only the last job.initializa name is used in the loop so it inserts 3 times the same php POST.
For example, I run 4 times the for loop inside meterlineas, with 4 diferents values and 4 diferents Job initialize names but always, it runs 4 but wiht the same job initialize name and obviously with the same link parameters,
can you help me?

Thanks in advanced..
Jose


B4X:
Sub meterlineas
    'bucle que inserta las lineas del pedido
    Dim temporal,temporal3 As String
    Dim articulos As Int=0
    Dim Job420 As HttpJob
         For i=1 To TableView1.GetItems(0).Size
    Dim tc As TableCell = TableView1.GetItems(0).Get(i-1) 'Get the second item in the first section
'   
If cantidades.Get(i)>0 Then
    articulos=articulos+cantidades.Get(i)
    temporal=tc.Text.ToString
    temporal3=NumberFormat((tc.DetailText.ToString*cantidades.Get(i)),0,2)
    cadenapedidoxx=temporal&"     "&temporal3&"€      "&cantidades.Get(i)&" x "& _
    tc.DetailText.ToString&"€"
  Job420.Initialize("Job420"&i, Me)
Job420.Download2("http://www.XXXXXXXXX.XXX.php",Array As String("pedido",pedido,"linea",cadenapedidoxx))
End If   
    Next

End Sub

Sub JobDone (Job As HttpJob)
    If Job.Success = True Then
        Select Job.JobName
       
        Case "Job4"
            If Job.GetString.Contains("Registro insertado")=True Then
            'metemos las lineas
            meterlineas
.... rest of code (job.release,etc...)

End sub
 
Top