With this report you can see all attachments inserted in MMEX.
Currently links to open directly attachment on filename works only if you use a custom directory as attachments archive.
SELECT A.reftype AS Type, A.refid AS Nr,
C.transdate||' | '||AC.AccountName||' | '|| CURR.pfx_symbol||round(C.Transamount, 2) ||CURR.sfx_symbol AS Reference,
A.description AS Description, A.filename AS File,
(SELECT infovalue FROM infotable_v1 WHERE infoname = 'ATTACHMENTSFOLDER:Win' COLLATE NOCASE) AS BasePath,
"\"||A.reftype||"\"||A.filename AS FilePath, '' AS BasepathLUA
FROM attachment_v1 A
INNER JOIN checkingaccount_v1 C ON C.transid = A.refid
INNER JOIN accountlist_v1 AC ON C.accountid = AC.accountid
INNER JOIN currencyformats_v1 CURR ON AC.currencyid = CURR.currencyid
ORDER BY A.reftype,A.refid,A.filename;
function get_base_path (BasePath,FilePath)
if BasePath == "DOCSDIR" then
BasePath = "#";
elseif BasePath == "MMEXDIR" then
BasePath = "#";
elseif BasePath == "DBDIR" then
BasePath = "#";
else
BasePath = "file:///" .. BasePath .. FilePath;
end
return BasePath;
end
function handle_record(record)
record:set("BasepathLUA", get_base_path(record:get("BasePath"),record:get("FilePath")));
end
This report is helpful and working well except for one thing. While it lists all of the transactions that have attachments, when I click on the hyperlink that I assume is designed to open the attachment, it comes up with a blank screen with only a small box with an "x" in it in the upper left hand corner. I do have the MMEX database in a folder called "MoneyManagerEx Mobile" which is located in my DropBox account. That may be causing the problem but I wasn't sure whether/how to change the path since it seems to be generated automatically in the Lua and I didn't want to mess anything up. Any directions would be appreciated.
I was also wondering if it would be possible somehow to make it possible to click on the transaction number (or something) and have it open the transaction associated with the attachment?
Thank you for the response. I did check the settings under Options > Import/Export > Attachment Settings. I did in fact have the wrong folder specified but even after correcting that, it is still not working. When I selected the "systems subdirectory" option, nothing happens when I click on a link on the Attachment report. When I select "Money Manager Directory" option and click on a link, nothing happens. When I select "Database file directory" option, nothing happens--well, technically it scrolls back to the top of report. When I select "User Defined" option, and dig down to the "attachments\Transactions" folder (where I can see the attached pdfs in file explorer), and click on a link I get a page that shows "This page can't be displayed." I am not sure where I am going wrong on this.
As I've written, report currently works only if you choose "User Defined".
In "User Defined" you have to set the path to top-level folder, so in your example:
dig down to the "attachments\Transactions" folder
you have to choose "attachments" folder, not "Transaction" folder that is auto-created by MMEX.
Please take attenction modifying attachment folder if you have already inserted attachments because,
if not well managed, it can breaks expected behaviour and file structure.
Thanks again. I actually had the path set to the "Attachment's folder originally. I reset the path to that folder and am back to getting a blank screen with a small black box with an "x" in it at the upper left corner. I don't know if it will help, but I am attaching a screen shot with the option dialog open showing the path as it is set; behind the option dialog is the report screen after clicking on a link in the attachment report (path is set as shown in the options dialog). Sorry to be difficult, but I don't see what is wrong. BTW, when I click on the paper clip icon on a transaction with a file attached, the attachment pdf opens correctly with this setting.