Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3516 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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. 

Posted

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)
)
Posted

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. 

Posted

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.

Posted

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. 

Posted

Maybe it is a screen resolution thing but it looks like there is a space before .jpg

Try ".jpg" not " .jpg"

Posted

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. 

This topic is 3516 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.