Android Question call multi httpjob

nadhiras

Member
Licensed User
Longtime User
if I have 3 HttpJob requests, how do I do this, does it separate each JOB like this:

B4X:
Wait For (CallSub(Me, "job1")) Complete (Result As Boolean)
    If Result Then
     .....
    End If

Wait For (CallSub(Me, "job2")) Complete (Result As Boolean)
    If Result Then
     .....
    End If

Wait For (CallSub(Me, "job3")) Complete (Result As Boolean)
    If Result Then
      ......
    End If

or like this:

B4X:
Wait For (CallSub(Me, "job1")) Complete (Result As Boolean)
    If Result Then
       Wait For (CallSub(Me, "job2")) Complete (Result As Boolean)
         If Result Then
            Wait For (CallSub(Me, "job3")) Complete (Result As Boolean)
               If Result Then
                 ......
               End If
        End If
    End If
 

DonManfred

Expert
Licensed User
Longtime User
Do you want them to call in order? Use the seconds version.
 
Upvote 0

nadhiras

Member
Licensed User
Longtime User
yes must in order don...

in the 2nd job there is a SQL command and I use SQL.AddNonQueryToBatch.
whether the third JOB is better placed in the sub SQL_NonQueryComplete?
so it becomes like this :

B4X:
Wait For (CallSub(Me, "job1")) Complete (Result As Boolean)
    If Result Then
       Wait For (CallSub(Me, "job2")) Complete (Result As Boolean)
         If Result Then
                     ....................
                    SQL.AddNonQueryToBatch(................))
                   SQL.ExecNonQueryBatch("SQL")
        End If
    End If

Sub SQL_NonQueryComplete (Success As Boolean)
    If Success Then
         Wait For (CallSub(Me, "job3")) Complete (Result As Boolean)
               If Result Then
                 ......
               End If
    End If
End Sub

or remain as before ?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
o you want them to call in order? Use the seconds version.
Unless I'm misunderstanding something about Wait For, both versions (shown in the first post of this thread) execute in order. The difference is that in the first version, the following Wait For's are executed without regards to what the previous Wait For's return value for Result is (True or False, the other Wait For's execute), whereas in the second example, each of the following Wait For's are only executed if Result is True.
 
Upvote 0
Top