@tedsch
There is no built-in functionality to check for when data is synced, but you can use the function I’ve written below for that purpose. Please note, this script is provided as is and is not guaranteed to work in all scenarios.
I’ve written a function below that you can use to check the event log for a particular event ID by opening an export block descriptor. I’ve included a lot of comments in the function to help explain it.
USER SECTION
FUNCTION checkEvent($strToCheck$, $ebd$)
$newDataFound% = 0
PRINT TIME$ + ": Checking for data synchronization..."
$file$ = "exp:" + $ebd$
// Open EBD as file over the last one minute
OPEN $file$ FOR TEXT INPUT AS 1
// Loop through lines in text file
$Loop:
$A$ = GET 1 // Get the next line of the file
IF ($A$ <> "") THEN // If the line is not empty then..
$E% = INSTR 1,$A$,$strToCheck$ // Search for the string event ID entered as the $strToCheck$ function parameter
IF $E% <> 0 THEN // If not 0 (means that the string was found), go to send the email notification, update the Boolean tag, and close the file
$newDataFound% = 1
PRINT "Data has been synced"
CLOSE 1
// Send notification email
SENDMAIL "emailaddress@domain.com", "", "Data has been synchronized", "You can now pull the data that was synced with event " + $strToCheck$
Print "Email has been sent"
ENDIF
ELSE GOTO $Loop
ENDIF
CLOSE 1
PRINT TIME$ + ": Ending check for data synchronization"
ENDFN
END
The function takes two parameters, a string to check ($strToCheck$) and an export block descriptor ($ebd$). I’m using the event ID 1073773732 which is recorded in the Event Log when the Data management (DataMailbox, eSync) is complete. The accompanying description is esync-End of Data management export (0 min).
I’ve used our Export Block Descriptor (EBD) Helper online tool to generate an EBD of “$dtEV $ftT $st_s60 $et_s0” which retrieves the event log in text format with a start time of 60 seconds ago to an end time of 0 seconds ago. You can of course customize this time frame to best suit your needs.
In your Flexy’s Init section, you can set a timer to call the function. In my example below, I’ve called it every 60 seconds.
INIT SECTION
TSET 1, 60
ONTIMER 1, "goto CheckEventFunction"
CheckEventFunction Label in a User Section
CheckEventFunction:
eventString$ = "1073773732"
ebdString$ = "$dtEV $ftT $st_m1 $et_s0"
@checkEvent(eventString$, ebdString$)
END
Using the above timer, the function will be called every 60 seconds to check the event log over the past 60 seconds for the specified event.
Please let us know if you have any further questions, and I hope this helps.
-Ashley@HMS