Hi, I need help with this code.
My problem is that when I do the first executeremotequery (select max_instance) does not do the process of going to jobdone, therefore it does not bring me the data I need (maxinst) to then make the second executeremotequery (insert apv_list)
I do not know if I explain myself very well.
B4X:
Sub btnExportar_Click
Dim cuentaAnt As String
Dim sql As String
sql = "Select * FROM APVMOVIL Where APVEstado <> 'xx'"
Dim listaAPV As List
listaAPV = DBUtils.ExecuteMemoryTable(Starter.sql, sql, Null, 0)
If listaAPV.Size = 0 Then
Msgbox("No hay articulos para exportar", "Mensaje")
Else
Dim values() As String
cuentaAnt = 999999
For i = 0 To listaAPV.Size -1
values = listaAPV.Get(i)
cuentaIns = values(0)
If cuentaAnt <> cuentaIns Then
cuentaAnt = cuentaIns
ExecuteRemoteQuery("Select max(APVInstancia) from APV where CuentaID = " & cuentaIns , MAX_INSTANCIA)
maxinst = maxinst + 1
End If
ExecuteRemoteQuery("INSERT INTO APV VALUES ("&values(0)&", "&maxinst&", "&values(2)&", "&values(3)&", '"&values(4)&"', "&values(5)&", '"&values(6)&"', "&values(7)&", '"&values(8)&"', '"&values(9)&"', "&values(10)&", "&values(11)&", '"&values(12)&"',"&"' '"&",'', '"&values(13)&"')", LISTA_APV)
Next
End If
End Sub
My problem is that when I do the first executeremotequery (select max_instance) does not do the process of going to jobdone, therefore it does not bring me the data I need (maxinst) to then make the second executeremotequery (insert apv_list)
I do not know if I explain myself very well.
Last edited: