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

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

Recommended Posts

Posted

If you are inserting pictures NOT as a reference then a simple Set Field step will do the trick:

Set Field [MYTABLE::Name; MYTABLE::Container]

Make sure the Path field is a text field and FileMaker will automatically convert the picture to the original file name.

If you are storing your pictures as references, you will need a more complex formula in order to extract just the file name. The same Set Field shown above would result in the size as well as several paths. All you need is the very last value so this simple formula in the Set Field calculated result option will work:

RightValues(Substitute(MYTABLE::Name; "/"; "¶"); 1)

This formula replaces all of the "/" in the path with return characters so you can easily grab the last value using the RightValues function.

Posted

...RightValues(Substitute(MYTABLE::Name; "/"; "¶"); 1)

This formula replaces all of the "/" in the path with return characters so you can easily grab the last value using the RightValues function.

Worth bearing in mind, though, that the RightValues( ) function, like all of the xxxValues( ) suite of functions, returns a result which has a trailing carriage return.

That may or may not be a problem for you, depending on what you intend to do with the file name once you have it in the field. However if it is likely to present a problem, you could remove it in any of various ways, one of which would be:

Let([

x = Substitute(MYTABLE::Name; "/"; "¶");

y = RightValues(x; 1)];

Left(y; Length(y) - 1)

)

- or another would be to enclose the original formula within a further Substitute( ) function, to replace ¶ with "". etc etc :)

Posted

You could also use the following formula to remove the trailing return:

LeftWords(RightValues(Substitute(MYTABLE::Name; "/"; "¶"); 1); 999999999)

Hi John,

It may not be a problem if the picture files will follow known naming conventions (and given they will have extensions from a fairly predictable subset), but there is a caveat to keep in mind when using one of the xWords( ) functions in this way.

The xWords( ) functions not only strip leading and trailing carriage returns but in addition, will strip off leading and trailing spaces, periods, punctuation marks and any combination thereof.

So in the case of file names, if you store a file with the name "__ * 0123.png", using LeftWords( ) in this way will return only "0123.png" or for a file called "• (0251)_block.C++", it will return only "1251) _block.C".

Like you, I've used the xWords( ) functions in this way sometimes, but have found that it pays to be mindful of this particular limitation. :)

Posted

Hi John,

It may not be a problem if the picture files will follow known naming conventions (and given they will have extensions from a fairly predictable subset), but there is a caveat to keep in mind when using one of the xWords( ) functions in this way.

The xWords( ) functions not only strip leading and trailing carriage returns but in addition, will strip off leading and trailing spaces, periods, punctuation marks and any combination thereof.

So in the case of file names, if you store a file with the name "__ * 0123.png", using LeftWords( ) in this way will return only "0123.png" or for a file called "• (0251)_block.C++", it will return only "1251) _block.C".

Like you, I've used the xWords( ) functions in this way sometimes, but have found that it pays to be mindful of this particular limitation. :

I agree and should have mentioned it in my post. Thanks.

Posted

This my or may not belong here, but following your discussion of the xWords() functions... I was surprised today to find that the functions behave somewhat differently depening on what precedes the . (dot).

I was using RightWords() to check the extension of a file and found that my calc failed. Of course now I know to use a different method...

I was checking the name of a file in a container field "object" to see if it was of the pdf type.

RightWords(GetAsText( object ); 1)

returns "pdf" when the file is anything123.pdf but it returns "anything.pdf" when it has no numbers preceding the dot.

I thought it strange. I am open for thoughts on why this woud be.

  • 2 months later...
  • Newbies
Posted

If you are inserting pictures NOT as a reference then a simple Set Field step will do the trick:

Set Field [MYTABLE::Name; MYTABLE::Container]

Make sure the Path field is a text field and FileMaker will automatically convert the picture to the original file name.

Can't get this to work--I'm getting a ?. Tried as a script step, calculated text field, and text field with a default calculation. Can someone help?

This topic is 6700 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.