April 7, 201510 yr I have a script that I found about five years ago but do not know where. It has been working great until now let me explain. I have a database of students that we always match the pictures up by their student ID so that was easy. I would use as follows: In my field I would create an "image field" and make it a container then I would click on options and put in the calculate field I would put: "imagewin:/c:/Photos/" $Students::StudentID & ".jpg" So the picture of the student also was identified by their ID number not by name. This has worked for 5 years and still does. The problem I have now though is that we created another database and we want to bring pictures in by their name because this group of students does not have a student ID but they each have a unique name. So their pictures are identified by name. So I did this: "Imagewin:/C:/Photos/" & Students::StudentName & ".jpg" When I import it says it import 0 out of 0. It will not import any pictures. Any ideas? Thank you.
April 7, 201510 yr Where exactly does import come into play here? Or a script? All you have described is a calculation field.
April 7, 201510 yr Author I apologize. Here is the script: Let ( [ // Transform the contents of a container file name Images into text ImageRef = GetAsText (ImagePath); Photos = Position (ImageRef; "/"; 1; PatternCount (ImageRef; "/")) ]; Middle (ImageRef; Photos + 1; Length ( ImageRef) - Photos) )
April 7, 201510 yr Author Yes let me be more specific. I can understand that it is fragmented. I have table named "Players" in the table I have two fields that relate to the image. One field is "Imagepath" which is a calculation which is where i put the following. Let ( [ // Transform the contents of a container field named Images into text ImageRef = GetAsText ( ImagePath); Photos = Position ( ImageRef; "/"; 1; PatternCount ( ImageRef; "/")) ]; Middle ( ImageRef; Photos + 1; Length ( ImageRef) - Photos) ) The calculation result is a number. Then I have a field called "Images" which is a calculation and that is where the following is put. "imagewin:/C:/Photos/" & Players::PlayerName & ".jpg" So this works perfectly if I relate the pictures that have the student ID such as 111111 to the field in the students record that has the ID 111111. But now we have another database and we want to correspond the pictures which are labeled with their name to a corresponding field in the database that has their name but we are coming up with 0 when the import is done. Hope that makes sense now.
April 7, 201510 yr No, I am afraid I am getting more confused as we go on. If you have a folder of images, where each image is named the same as a Player in your Players table, then a calculation field (result is Container), defined in the Players table as = "imagewin:/C:/Photos/" & PlayerName & ".jpg" should display the corresponding image. No other calculation field, or script, or import are required for this. If the field does not display the expected image, then either the image does not exist or the real name of and/or the path to the image are different from the calculated ones.
April 7, 201510 yr Author I am also confused. Because if I change the pictures to a correspond with a unique ID number on the layout the pictures show up. Just will not do it with the user name.
April 7, 201510 yr Maybe it is a screen resolution thing but it looks like there is a space before .jpg Try ".jpg" not " .jpg"
April 8, 201510 yr Author Thank you for you help. But there was not a space in between. The script works if I have correspond to a number on my layout just not text. This is baffling. I have tried putting an underscore between first and last name I even put them together without a space but nothing.
Create an account or sign in to comment