AddAttachement
Back to ListDescription: Add a new record in a table, based on users selected file.
FileMaker Prototype:
Set Variable [$res; ACF_Run("AddAttachement")]
Category: UTILITY
Function source:
function AddAttachement ()
string path = select_file ("Select file to add to the e-mail", desktop_directory());
string primkey, sql, res;
if ( path != "" ) then
primkey = Email_Messages::PrimaryKey;
sql = "SELECT FilePath FROM Email_Attachements WHERE fk_EmailMessage = :primkey AND FilePath = :path";
res = ExecuteSQL ( sql);
if ( res != "") then
alert ( "File allready added: " + res);
return "";
end if
sql = "INSERT INTO Email_Attachements (fk_EmailMessage, FilePath) VALUES (:primkey, :path)";
res = ExecuteSQL ( sql);
return res;
end if
return "";
end
AddAttachement Is part of the demo E-mail application available for download. It is run when hit a button on the send-email layout, that lets the user select an attachement, and insert it into the related attachement table.
I add it here, since it also can be used with some slight modifications to accomplish "Add portal row", functionality.
Example
Set Variable [$res; ACF_Run("AddAttachement")]
Here is the Attachement portal, the function is run on the "+" button.

