Using RDC.
I have several subs that insert new records into various tables.
After each batch is inserted, I invoke a ChecktoSend method which will send all new data.
The JobDone is responsible for determining if the data actually hit the server. If it did, it marks all records in the table as being SENT (then where sent = 1, records are deleted to keep bloat down).
The issue is, I use ChecktoSend in many areas. The results are the tables are delivered twice (maybe three time) and duplicate data is inserted because the JobDone had not returned from the first call to mark records as being SENT.
Question:
How would you make ChecktoSend wait until the first call had completed - before calling it again from another process?
Using B4A 6.30 (but have 7 ready to install).
Thanks
I have several subs that insert new records into various tables.
After each batch is inserted, I invoke a ChecktoSend method which will send all new data.
The JobDone is responsible for determining if the data actually hit the server. If it did, it marks all records in the table as being SENT (then where sent = 1, records are deleted to keep bloat down).
The issue is, I use ChecktoSend in many areas. The results are the tables are delivered twice (maybe three time) and duplicate data is inserted because the JobDone had not returned from the first call to mark records as being SENT.
Question:
How would you make ChecktoSend wait until the first call had completed - before calling it again from another process?
Using B4A 6.30 (but have 7 ready to install).
B4X:
' What I just did to combat these dups...
Sub ChecktoSend
' Sending var is a process_global
If Sending = False Then
Sending = True
Select LogCM.CurrLogName
Case "Shift Start", "Shift End", "On-Duty", "Log Out"
' ToastMessageShow(" Calling Update Server... "&LogCM.CurrLogName,False)
AddLoadRecs
AddTIRecs
AddEvents
' AddLogRecs ' moved to proper place
AddScaleRecs
AddShiftMast
If (LogCM.CurrLogName = "Shift End") Then
CallSubDelayed(Me, "Backupfiles")
End If
End Select
End If
End Sub
Sub JobDone(Job As HttpJob)
'........ handle many results ........
If result.Tag = "scale_mast" Then ' RDC query tag
DefCM.SQL1.ExecNonQuery("UPDATE scalemast1 Set sent = 1 WHERE sent = 0")
DefCM.SQL1.ExecNonQuery("DELETE FROM scalemast1 WHERE sent = 1") ' clean table
End If
' last lines...
Job.Release
LogServmod.Sending = False ' safe to send again since above
End Sub
Thanks
Last edited: