TaiChi56 Posted October 8, 2009 Posted October 8, 2009 I have a student database made in FileMaker Pro 9. I need to bring in 2400 students photos. I thought I had it but it did not work. The photos are .jpg so they are numbered by their six digit student ID. Example: 111111.jpg So I made a field called studentID and made it a container. Then I put that field on my layout. I went to Import records..Folder. It gave me these options: Image File Name File Path Image Thumbnail So I put the Image with StudentID. Thinking that the 111111.jpg would go with the StudentID 111111. But all it does is bring in every photo in order,obvousily not the right file per student. What am I doing wrong? All the photos are in one folder called "Pics"
Matthew F Posted October 9, 2009 Posted October 9, 2009 I'd suggest doing the following: Create a 'StudentID' field and a separate 'StudentPhoto' calculation field. Set the calculation to be type container with the following formula: Set Field [studentPhoto; "image:pics/" & StudentID & ".jpg"]
IdealData Posted October 9, 2009 Posted October 9, 2009 mfero's advice will work, but this will mean that the original JPG files must remain in the same location forever. You need to do a double pass of the photos... Start with a new table and create suitable fields to hold a container and a filename. 1. In the first pass, use the import from folder - but STORE AS REFERENCE. This will then give the chance to import the filename that you can use as a link to the student record. You will need to do a little string manipulation to extract the "record id" you have used as the file name. Create another container field 2. In the second pass, import the photos to a the new container field but DO NOT store as reference and use the UPDATE existing records - this way the photos are now part of the FM file - and should be in the same order. Now link your original students table to the new "photos" table using the "record id" field. Create another container in the "students" and use REPLACE FIELD CONTENTS, using a CALCULATED result which is the photo in the now related "photos" table. When done you can remove the "photos" table as the data is now in the "students" table. BEWARE - your file will probably "bloat" quite a lot after the import.
comment Posted October 9, 2009 Posted October 9, 2009 mfero's advice will work, but this will mean that the original JPG files must remain in the same location forever. I don't see why. If you move the image files to another location, you can change the calculation formula. Or - preferably - keep the location's path in a global field or in a one-record Settings table, where it can be changed without modifying the schema. Of course, the calculation should NOT include Set Field[], only = Case ( Abs ( Get (SystemPlatform) ) = 1 ; "imagemac:/" ; "imagewin:/" ) & gLocationPath & StudentID & ".jpg".
Fenton Posted October 9, 2009 Posted October 9, 2009 I agree with the calculation field method in this case, as it seems the pictures' folder structure and names would be known. But I just wanted to answer the original poster's question, "what am I doing wrong." You were using the Import Folder step. You cannot match up a container field as the key field when using the Import Matching records option, nor can you match to Image. FileMaker will not toggle the match to an equals sign. So you could not have done what you said. You would want to match up a FileName (or FilePath) field to the file name of the picture, Text field to text file name.
TaiChi56 Posted October 9, 2009 Author Posted October 9, 2009 I was looking at this method. But I am getting an error that says "there is not a set field" I made StudentID a container and then made StudentPhoto a calculation like you have set up. But it does not like the Set field. Please advise. P.S. Thank you for all the help. I work in a school and it gets crazy here at times.
TaiChi56 Posted October 11, 2009 Author Posted October 11, 2009 Ok, I found this in a file reference search. Still confused because I keep getting an error "The specified field cannot be found". Here is the code I found: Set Field [Personnel::idPhoto; "imagewin:/D:/Photos/" & Personnel::employeeID & ".jpg"] will set idPhoto to show "23456.jpg" from the D:/Photos directory, when employeeID is 23456. Here is what I put in: Set Field [Personnel::idPhoto; "imagewin:/C:/Photos/" & Personnel::StuID & ".jpg"] I put my photos in the C directory. Here is where I am confused. Do I make the idPhoto a container and make StuID the calculation or the Personnel the calculation. Not sure what do with this. I know that I am close just not understanding the Set Field function. All 2400 of my images have a 6 digit reference i.e. 111111.jpg so I just need it to match the stu id in the database and show the picture. Please advise. Thank you very much.
comment Posted October 11, 2009 Posted October 11, 2009 Set Field[] is not a function - it is a script step, and it has no place in a calculation formula. Your ID field should remain what it was (Text or Number). Make the photo field a calculation field (result is Container) = "imagewin:/C:/Photos/" & Personnel::StuID & ".jpg"
TaiChi56 Posted October 12, 2009 Author Posted October 12, 2009 Thank you for the help. I made stuID text, then made IDPhoto a calculation with the following: "imagewin:/C:/Photos/" & Student::StuID & ".jpg" Student is my table. On my layout I used the field StuID. I am getting this where the picture should be showing up.. " The file cannot be found 111111.jpg" I have my photos in the C:/Photos. What could be wrong? Thank you for your help so far.
Matthew F Posted October 12, 2009 Posted October 12, 2009 comment... Set Field[] is not a function - it is a script step, and it has no place in a calculation formula. That's correct. My apologies for the mistake. I first meant to suggest a script but then changed my mind to suggest a calculated field, but forgot to fix the text. TaiChi... I am getting this where the picture should be showing up.. " The file cannot be found 111111.jpg" I have my photos in the C:/Photos. What could be wrong? You will get that error if the pathname in your calculation is wrong. Are you sure the photos are in "C:/Photos"? In your original post you said the photos are in a folder called "Pics".
TaiChi56 Posted October 12, 2009 Author Posted October 12, 2009 (edited) Yes, I put them in C:Photos thinking that would be a good place to keep them without worrying about a folder being deleted. I do notice that my error has extra white space between it, does that matter? (i.e. 111111 .jpg) I also notice that if I change the StuID to IDPhoto in "imagewin:/C:/Photos/" & Student::StuID & ".jpg" I get this error instead: I get 111111 .jpg.jpg I know I am close just cannot seem to manipulate it. Edited October 12, 2009 by Guest
TaiChi56 Posted October 12, 2009 Author Posted October 12, 2009 Ok, I still get the "This file cannot be found 111111 .jpg" (It shows the extra white space). I double click on that box, which is where my container is sitting and it will open the Photo folder, I can scroll to 111111.jpg. When I double click the photo, I get this error message: "This action cannot be performed because this field is not modifiable."
Matthew F Posted October 13, 2009 Posted October 13, 2009 still get the "This file cannot be found 111111 .jpg" (It shows the extra white space). I'm pretty sure the extra space means your calculated field definition is wrong. Are you sure it doesn't read: "imagewin:/C:/Photos/" & Student::StuID & " .jpg" (with a space before the '.jpg'? Alternatively, you might have extra spaces tacked onto the Student IDs.
TaiChi56 Posted October 13, 2009 Author Posted October 13, 2009 Solved: I made a rookie mistake. My Excel that held the student ID's had leading and trailing spaces. As soon as I trimmed those the pictures popped up. Thank you for everyone's help.
funkatudinal Posted October 14, 2009 Posted October 14, 2009 Hi guys, I am basically doing the same thing (trying to...), but my problem is that the calculation field (calculation result=container) is just showing the path to the image as text inside the container -- not the image. thanks for any input!
Fenton Posted October 14, 2009 Posted October 14, 2009 Did you choose "Container" as the result of the calculation? Did you set Storage Options to [x] Do not store?
funkatudinal Posted October 15, 2009 Posted October 15, 2009 Thanks Fenton, that fixed it, works perfectly now. (also an erroneous space was throwing everything off). thanks again.
Recommended Posts
This topic is 5517 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