assert
Back to ListDescription: Verify of the two parameters are identical, otherwise throw an exception
FileMaker Prototype:
Set Variable [$res; ACF_Run("Assert"; String_s1; string_s2; string_message)]
Category: UTILITY
Function source:
function Assert ( String s1, string s2, string message )
if ( s1 != s2 ) then
throw (message);
end if
return true;
end
The Assert function is primarily used within other ACF functions to verify that an operation’s result matches the expected value. If the values do not match, an exception is thrown. Calling Assert directly from FileMaker isn’t meaningful, as exception handling doesn’t propagate into FileMaker scripts.
Example
Assert(SomeResultVariable, "OK", "Error performing operation: " + SomeResultVariable)
In this example, if SomeResultVariable does not contain "OK", it likely indicates an error. The Assert function will then trigger an exception, causing the operation to abort unless it’s within a TRY/CATCH block that handles the error.
