Hey there, I've been using FileMaker for over a decade now, but this weird behavior is a first for me
The failing part of my script works like so:
Set Variable [ $Manual ; Value: IsEmpty ( Get ( ScriptParameter ) ) ]
Set Variable [ $ID ; Value: If ( $Manual ; All Schedules::ID ; Get ( ScriptParameter ) ) ]
New Window [ Style: Document ; Using layout: “Manage Schedule” (SCHEDULE) ]
Set Error Capture [ On ]
Perform Find [ Restore ]
# FIND [ SCHEDULE::ID ==$ID ]
When called by the server, the script parameter is always supplied.
This script is called every morning, and usually succeeds
After the find request, I log Get ( ScriptParameter )
, $ID
, and SCHEDULE::ID
The weird thing is, sometimes, seemingly at random, it will simply fetch the wrong records!
When running the script again, with the exact same parameters, also from the server, it suddenly works, as if trying to hide the bugs.
Latest failure, yesterday, logged the following
Script Parameter: 32970
$ID: 32970
Schedule ID: 1247
It is always Schedule 1247, it is the seventh record, and the first that is also connected to MAIN
So, when doing SCHEDULE::ID
from the MAIN single-record table, the first record returned is ID 1247
But why would that be related to a Perform Find request that runs on a SCHEDULE layout, with a numeral $ID supplied by the script parameter??
I've been trying to track this error for two months now and I've no clue as to why a simple find request of SCHEDULE::ID ==$ID
fetches the wrong $ID!
Furthermore, I implemented a check after the find result that goes like so:
If [ SCHEDULE::ID ≠ $ID ]
# Schedule mismatch
Perform Script [ ... ] // Log error and data
Close Window [ Current Window ]
Exit Script [ Text Result: ]
End If
And this does not fire! It passes as if it didn't fail, then it continues on with the wrong Schedule!