Page 1 of 1

Display Media File Name only

Posted: 22 Oct 2022 14:02
by Vyger
I hoping one of the FH experts can answer here but at present I am guessing it is just not possible.

I maintain a media collection carefully named to a standard I adopted many years ago, Ancestry and other crazy file names often invade my collection and I want to filter and resolve these using the new Rename options.

The problem I have hit is one of displaying Media File Name only as a column, I see the Right, Left and Mid functions but no way to calculate the split from the string? In VBA what I am looking for would be best described below but there is no InStr function I can find in FH

Mid(OBJE.FILE, (InStrRev(OBJE.FILE, "\")) + 1)

Am I right in making the assumption this cannot be done?

Thankfully FH displays file name only in the Title where a Custom Title has not yet been added by the user.

Re: Display Media File Name only

Posted: 22 Oct 2022 16:46
by ADC65
I think the function FindText does this ... have a look here:

https://www.family-historian.co.uk/help ... dtext.html

Re: Display Media File Name only

Posted: 22 Oct 2022 18:25
by ColeValleyGirl
I believe that you need to use a function (FieldText or GetFieldText?) to access the file path/name FILE.OBJE as a text string; and then use the Section function to split it first at the last path separator and then at the "." between name and extension.

However, I can't get the exact syntax right (every time I use a data reference I have to go back to basics), and I could be completely wrong.

Re: Display Media File Name only

Posted: 22 Oct 2022 23:32
by ADC65
A quick experiment shows that:

Code: Select all

=FindText(%OBJE.FILE[1]%,"\")
will return the position of the first backslash character. You can then use MID or SECTION to grab the text you need. The difficulty for me is that my File shows multiple backslashes for directory nesting, and they have different levels, eg:

Code: Select all

Media\Census\UK Census 1921\UK Census 1921 - Wales, New Tredegar, 27 Pritchards Terrace.jpg
Media\Census\Non UK\US\1950\US Census 1950 - Pennsylvania, Blair, Altoona, 228 22nd Avenue.jpg
And I couldn't figure how to distinguish the last blackslash.

Re: Display Media File Name only

Posted: 23 Oct 2022 06:47
by David2416
There could be multiple \ and multiple dots. Get the string length, find last dot position and last\ position then you use a mid string function. Might help to reverse the string.