Steve E. Posted October 5, 2011 Posted October 5, 2011 I've got a database that includes a container field that I wish to use for PDFs, so that it will be possible to access the PDF from inside the database. Its trivial to use the "insert file" command and then navigate to the desired file to link it in the container field. But here are my problems: 1) There are over 400 PDFs altogether and each needs to be linked to a different record. The name on each PDF begins with a number that corresponds to a unique ID number for each record in the database. Is there a way to mass import the PDFs , both generally and also link them to the appropriate record? 2) The PDFs I have linked (in container fields) to the appropriate records reside within a folder that is within several other folders. If I move any folder at all, the link is broken and I have to re-link it. This is a real pain! I can't believe that this function is this non-resilient! Is there a way to make this more robust so the links are broken this easily? Thanks in advance for any suggestions. -Steve
comment Posted October 5, 2011 Posted October 5, 2011 The name on each PDF begins with a number that corresponds to a unique ID number for each record in the database. You could calculate the path.
Steve E. Posted October 5, 2011 Author Posted October 5, 2011 Could you please give me an example of such a calculation? Thanks.
comment Posted October 5, 2011 Posted October 5, 2011 If, for example, you have a global text field gFolder containing "MacintoshHD/Users/Alfred/Documents/Contracts" and a text field CustomerID containing "123456", you can define a calculation field (result is Container) = "filemac:/" & gFolder & "/" & CustomerID & ".pdf" Assuming there is a file named ""123456.pdf" in the Contracts folder, the calculation field will "contain" a reference to it, and double-clicking it will open the file. You could also open the file using the OpenURL[] script step - but the calculated path syntax needs to be a bit different for that. Other options are using AppleScript (Mac) or Send Event[] (Win).
Steve E. Posted October 5, 2011 Author Posted October 5, 2011 This calculation "file:" & gPath_Folder & "OCR" & Import Index & ".pdf" produces a pdf image (symbol) with the correct name in the calculation (container) field. But when I try to open it, it is not found. I'm wondering if there is something wrong with the path in the "gPath_Folder" field. The full path is: B - WEAN/Brushfires/OH GMA UGA GMHB Challenges/11-2-0005/RecordDatabase/Records-"OCR/ "B - WEAN" is the volume. The rest are folders. Sorry. There's a typo in the path I posted above. There are no quotation marks ("). The correct full path is: B - WEAN/Brushfires/OH GMA UGA GMHB Challenges/11-2-0005/RecordDatabase/Records-OCR/
comment Posted October 5, 2011 Posted October 5, 2011 Why don't you insert the actual file as reference into a container field and compare the real path to the calculated one? Use GetAsText ( ContainerField ) to see the paths. Also state your platform.
Steve E. Posted October 5, 2011 Author Posted October 5, 2011 Well, eureka of a sorts. It works perfectly if I dispense with the global field for part of the path name and do it entirely with a calculation: "filemac:/" & "B - WEAN/" & "Brushfires/" & "OH GMA UGA GMHB Challenges/" & "11-2-0005/" & "Record/" & "Database/" & "Records-OCR/" & "OCR" & Import Index & ".pdf" However, if I use this calculation and path in the global field the file is not found: calculation: "filemac:/" & gPath_Folder & "OCR" & Import Index & ".pdf" path name in global field: B - WEAN/Brushfires/OH GMA UGA GMHB Challenges/11-2-0005/Record/Database/Records-OCR/OCR/ What's the error I'm missing? Consult: I'm on a 2009 Macpro Newhalem running Snow Leopard. I found the file path(s) by doing a find on the folder and double checked it just by drilling down through the folders. As you can see from above posts, I've solved the practical problem, but the question of why using a global field doesn't work remains. If you've got any hints on that, its appreciated. And thanks for your help.
comment Posted October 5, 2011 Posted October 5, 2011 Well, the first calculation returns: filemac:/B - WEAN/Brushfires/OH GMA UGA GMHB Challenges/11-2-0005/Record/Database/Records-OCR/OCR123456.pdf and the other one: filemac:/B - WEAN/Brushfires/OH GMA UGA GMHB Challenges/11-2-0005/Record/Database/Records-OCR/OCR/OCR123456.pdf
Steve E. Posted October 6, 2011 Author Posted October 6, 2011 Oaky. now I've got it working right using the call to the global field with the path to the folder in it. I've also done it as an "If" calculation referencing to another field that tracks what form the material record refers to is, so that if there is no file that exactly matches (i.e. no pdf file), it fills the container field with a message to that effect: here's the calculation: If ( Table::Scanned = "Yes" ; "filemac:/" & gPath_Scan_OCR & Index # & " OCR 11-2-0005.pdf" ; "No Scan Available" ) Thanks much for helping me out with this. -Steve
Recommended Posts
This topic is 4797 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now