Hi Gareth
In these circumstances the backslash has a special meaning (this is common in lots of computer languages).
It means the what follows is not text eg \0012 is an octal code for the line break character
To "type" an actual backslash you use \\ two backslashes together.
Code: Select all
“Z:\\Purchase Transaction” + " " + CString(AUDIT_SPLIT.TRAN_NUMBER)
By the way... the name of the folder is only the transaction number when there is only one split, it is otherwise a range of split transaction numbers
So "Purchase Transaction 1128 - 1138" is the folder for transaction 1128 with 11 splits.
You will have to calculate the last transaction number in a range using the number of items
Code: Select all
“Z:\\Purchase Transaction” + " " + CString(AUDIT_HEADER.TRAN_NUMBER)
and if they are different
Code: Select all
“Z:\\Purchase Transaction” + " " + CString(AUDIT_HEADER.TRAN_NUMBER) &" - "& CString(AUDIT_HEADER.TRAN_NUMBER+AUDIT_HEADER.ITEM_COUNT)
Now you also need to do an IF which is again poorly documented.
<Test Expression>?<what to do if test true>:<what to do when test is false>
So this is the expression I came up with for a hyperlink that opens the transaction folder of the transaction in the report in either case.
Code: Select all
AUDIT_HEADER.ITEM_COUNT>1?
"C:\\SageData\\2021\\DemoData\\Transaction Attachments\\Purchase Transaction" + " " + cstring(AUDIT_HEADER.TRAN_NUMBER)+" - "+cstring(AUDIT_HEADER.TRAN_NUMBER+AUDIT_HEADER.ITEM_COUNT-1)
:"C:\\SageData\\2021\\DemoData\\Transaction Attachments\\Purchase Transaction" + " " + cstring(AUDIT_HEADER.TRAN_NUMBER)
You also need filters on it to exclude transactions that are not purchase credits or purchase invoices.
Transaction Attachments are a NEW thing is Sage 50, the developer tools don't provide any way of setting them up, which is a real shame, there is not even a flag on the transaction to tell us if there are attachments (BTW if you don't have an attachment, the formula will still calculate the path, it just will not exist and so will return an error when you click on it)
You say this is for data entry, but that doesn't make sense as the attachments can not be attached until after the entry has been made.
I attach my test report.
Login to access the files attached to this post.