Question: How can I retrieve the physical file path of TIFF images and electronic documents stored in Laserfiche using the entry ID?
Answer: You can use the following SQL script to pull the physical file path of TIFF images and electronic documents from the entry ID. This script includes a conditional check to handle both TIFF images and electronic documents (e-docs).
DECLARE @entryID INT = 123
SET @entryID = 123
SELECT
dbo.toc.name AS DocumentName,
dbo.doc.pagenum + 1 AS PageNum,
CASE
WHEN edoc_storeid IS NULL THEN
dbo.vol.fixpath + '\' +
SUBSTRING(CONVERT(VARCHAR(8), CONVERT(VARBINARY(4), dbo.doc.storeid), 2), 1, 2) + '\' +
SUBSTRING(CONVERT(VARCHAR(8), CONVERT(VARBINARY(4), dbo.doc.storeid), 2), 3, 2) + '\' +
SUBSTRING(CONVERT(VARCHAR(8), CONVERT(VARBINARY(4), dbo.doc.storeid), 2), 5, 2) + '\' +
CONVERT(VARCHAR(8), CONVERT(VARBINARY(4), dbo.doc.storeid), 2) + '.TIF'
ELSE
dbo.vol.fixpath + '\' +
SUBSTRING(CONVERT(VARCHAR(8), CONVERT(VARBINARY(4), edoc_storeid), 2), 1, 2) + '\' +
SUBSTRING(CONVERT(VARCHAR(8), CONVERT(VARBINARY(4), edoc_storeid), 2), 3, 2) + '\' +
SUBSTRING(CONVERT(VARCHAR(8), CONVERT(VARBINARY(4), edoc_storeid), 2), 5, 2) + '\' +
CONVERT(VARCHAR(8), CONVERT(VARBINARY(4), edoc_storeid), 2) + edoc_ext
END AS FullPathAndFilename
FROM dbo.toc
LEFT JOIN dbo.doc ON dbo.doc.tocid = dbo.toc.tocid
LEFT JOIN dbo.vol ON dbo.toc.vol_id = dbo.vol.vol_id
WHERE dbo.toc.tocid = @entryID
ORDER BY dbo.doc.pagenum;
Explanation:
- DocumentName: The name of the document.
- PageNum: The page number of the document.
- FullPathAndFilename: The constructed full path and filename of the TIFF image or e-doc.
This script helps in retrieving the physical file path of TIFF images and electronic documents stored in Laserfiche by using the entry ID. Make sure to replace @entryID with the actual entry ID you are querying.