Hello everyone, I have a new question ...
I am working with DRC Server and everything works fine.
The function jobdone verify the result of the query and based on the result I perform certain operations.
The problem is when I have to run queries on different tables.
For example, run the query with the sub
sub EseguiPrimaQuery
sub EseguiSecondaQuery
The problem is that jobdone did not have time to intercept the outcome of the first query of the first who must now work for the second.
Is there a way to wait until jobdone give the result of the first query before you can run the second?
I attach the code I'm using
Thank you all for your cooperation
I am working with DRC Server and everything works fine.
The function jobdone verify the result of the query and based on the result I perform certain operations.
The problem is when I have to run queries on different tables.
For example, run the query with the sub
sub EseguiPrimaQuery
sub EseguiSecondaQuery
The problem is that jobdone did not have time to intercept the outcome of the first query of the first who must now work for the second.
Is there a way to wait until jobdone give the result of the first query before you can run the second?
I attach the code I'm using
Thank you all for your cooperation
B4X:
Sub Process_Globals
Dim DBRM As DBRequestManager
Dim CmdSql As DBCommand
Dim SQLDAT As DBResult
End Sub
Sub Globals
Dim BASE As Panel
Dim B001 As ImageView
Dim SE01 As Label
Dim SE02 As Label
Dim SE03 As Label
Dim SE04 As Label
Dim SE05 As Label
Dim PR01 As Label
Dim PR02 As Label
Dim PR03 As Label
Dim PR04 As Label
Dim PR05 As Label
Dim SP01 As Label
Dim SP02 As Label
Dim SP03 As Label
Dim SP04 As Label
Dim SP05 As Label
Dim P001 As ImageView
Dim LDATA As Label
Dim LNAME As Label
Dim LTIME As Label
Dim L001 As Label
'----- Parametro di Lavoro Eseguito
Dim TipLav As Int
Dim SqlSta As Boolean
Dim JobSta As Boolean
'----- Definizione Campi Records
'
'----- ANAZGR
Dim aagcodi As String
Dim aagraso As String
'----- ANELCO
Dim aeccosp As String
Dim aeccose As String
Dim aecprog As String
Dim aecdamo As String
Dim aecoreb As Int
Dim aecpart As Int
Dim aeccell As String
Dim aecorin As Int
Dim aecorfi As Int
Dim aecstat As Boolean
'----- ANSPDI
Dim asdcodi As String
Dim asddesc As String
Dim asdstat As Boolean
Dim asdse01 As String
Dim asdse02 As String
Dim asdse04 As String
Dim asdse05 As String
Dim asdse06 As String
Dim asdse07 As String
Dim asdse08 As String
Dim asdse09 As String
Dim asdse10 As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
'----- Avvia Il Programma
If FirstTime Then
Activity.LoadLayout("mwnc1020")
JobSta = False
'----- Inizializza DBase
GesConDba
'----- Pulizia Maschera
ClrMskAel
'----- Set Parametri Code
SetDatAel
End If
End Sub
'--------------------------------'
' INIZIALIZZAZIONE DBASE SQLITE '
'--------------------------------'
Sub GesConDba As Boolean
Try
'----- Composizione IP Server
DG.NomFile = "http://" & DG.sqlpar.Get(1) & ":17178"
DBRM.Initialize(Me, DG.nomfile)
Catch
Msgbox(LastException.Message,"ERRORE")
Return False
End Try
End Sub
'--------------------------------'
' PULIZIA MASCHERA VIDEO '
'--------------------------------'
Sub ClrMskAel
Try
SE01.Text = ""
SE02.Text = ""
SE03.Text = ""
SE04.Text = ""
SE05.Text = ""
PR01.Text = ""
PR02.Text = ""
PR03.Text = ""
PR04.Text = ""
PR05.Text = ""
SP01.Text = ""
SP02.Text = ""
SP03.Text = ""
SP04.Text = ""
SP05.Text = ""
LDATA.Text = ""
LNAME.Text = ""
LTIME.Text = ""
L001.Text = ""
Catch
Msgbox(LastException.Message,"ERRORE")
Return False
End Try
End Sub
'--------------------------------'
' SETTAGGIO PARAMETRI CODE '
'--------------------------------'
Sub SetDatAel
Dim Oggi As Long
Try
'----- Imposta Data Odierna
Oggi = DateTime.now
LDATA.Text = DateTime.Date(Oggi)
'----- Imposta Ora
Oggi = DateTime.Now
LTIME.text = DateTime.Time(Oggi)
'----- Lettura Dati Aziendali
GetAag
'----- Lettura Sportelli Disponibili
GetAsd
Catch
Msgbox(LastException.Message,"ERRORE")
Return False
End Try
End Sub
'--------------------------------'
' LETTURA SPORTELLI DISPONIBILI '
'--------------------------------'
Sub GetAag As Boolean
Try
TipLav = 1
CmdSql.Initialize
CmdSql.Name = "SEL_KEY_AAG"
CmdSql.Parameters = Array As Object("A001")
DBRM.ExecuteQuery(CmdSql, 0,"A001")
Catch
Msgbox(LastException.Message,"ERRORE")
Return False
End Try
End Sub
'-----------------------------------'
' VISUALIZZA RAGIONE SOCIALE '
'-----------------------------------'
Sub VisAag As Boolean
Try
'----- Verifica Esito Query
If SqlSta = False Then
Msgbox("DATI AZIENDALI NON DISPONIBILI","ERRORE")
Return False
End If
For Each records() As Object In SQLDAT.Rows
aagraso = records(SQLDAT.Columns.Get("aag_raso"))
LNAME.Text = aagraso
Next
Catch
Msgbox(LastException.Message,"ERRORE")
Return False
End Try
End Sub
'--------------------------------'
' LETTURA SPORTELLI DISPONIBILI '
'--------------------------------'
Sub GetAsd As Boolean
Try
TipLav = 2
CmdSql.Initialize
CmdSql.Name = "SEL_ALL_ASD"
CmdSql.Parameters = Array As Object("")
DBRM.ExecuteQuery(CmdSql, 0,"")
Catch
Msgbox(LastException.Message,"ERRORE")
Return False
End Try
End Sub
'-----------------------------------'
' VISUALIZZA SPORTELLI DISPONIBILI '
'-----------------------------------'
Sub VisAsd As Boolean
Dim p As Int
Try
'----- Verifica Esito Query
If SqlSta = False Then
Msgbox("ANAGRAFICA SPORTELLI NON DISPONIBILE","ERRORE")
Return False
End If
p = 1
For Each records() As Object In SQLDAT.Rows
asdcodi = records(SQLDAT.Columns.Get("asd_codi"))
Select Case p
Case 1
SP01.Text = asdcodi
Case 2
SP02.Text = asdcodi
Case 3
SP03.Text = asdcodi
Case 4
SP04.Text = asdcodi
Case 5
SP05.Text = asdcodi
End Select
p = p+1
Next
Catch
Msgbox(LastException.Message,"ERRORE")
Return False
End Try
End Sub
'--------------------------------'
' VERIFICA ESITO OPERAZIONE '
'--------------------------------'
Sub JobDone(Job As HttpJob)
If Job.Success = False Then
GesMsgErr
SqlSta = False
Else
If Job.JobName = "DBRequest" Then
SQLDAT = DBRM.HandleJob(Job)
SqlSta = True
Select Case TipLav
Case 1
'----- Anagrafica Sportelli
VisAag
Case 2
'----- Anagrafica Sportelli
VisAsd
Case 3
Case 4
End Select
End If
End If
Job.Release
JobSta = True
End Sub
'--------------------------------'
' VERIFICA ESITO OPERAZIONE '
'--------------------------------'
Sub GesMsgErr
Dim MsgTxt As String
Select Case TipLav
Case 1
'----- Lettura Anagrafica Sportelli
MsgTxt = "ERRORE IN LETTURA ANAGRAFICA SPORTELLI"
End Select
Msgbox(MsgTxt,"ERRORE")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub