The Position() function has a way to get "from the right". I suggest you research the help. Then given the value of that last ".", you can use the other functions to extract. Give it a whirl, if the examples don't help, I'm sure there are custom functions and/or someone will just tell you. If you learn, then 'exceptions' you may encounter can be adjusted by you in the calc. (.jpg <> .jpeg as the computer sees it, for example)
Sent from miPhone
Thanks for the reply. So I have looked at the position function and i can get a count to the "." which in my sample was 15
now my calc is
Let ($pos=Position ( Document Name; "." ; 1 ; 1 ));
Case ( Left ( Document Name ; $pos) = "<.>" ; Right ( Document Name ; Length ( Document Name ) - $pos ) ; Document Name )
I get an error there are too few parameters.
Am I on the right track with calc and if so which parameter am i missing i cant seem too see it.
Thanks again beverly
A rework on the previous based on a post of yours in a forum I have removed the number and specified a variable (highlighted in italics) and it works well in your form with the number not the variable. Beverly,
I do want to use the variable though as the number of letters may change depending on the extension i.e docx or doc or txt
Let ($pos= Position ( Document Name; "." ; 1 ; 1) );
Middle( Document Name ; $pos ; Length ( Document Name ) )
However, I am still getting the too few parameters so that is obviously in the let function area but what i am missing ? I have no idea. I have crossed checked with samples from filemaker and it appears that i have covered everything but obviously not. i am missing something.
After I walked away for a minute I came up with this calc and it works. No need for variables or anything.
Middle( Document Name ; Position ( Document Name; "." ; 1 ; 1)+1 ; Length ( Document Name ) )
Thanks for the pointed info.
But your position function searches from the left not the right.
Position ( text ; "." ; length (text) ; -1 )
will find the "." Located furthest to the right in text.
Did you see the -1 example? that already searches from the right to get the correct position.
From there you can use
Middle( text ; <<value from position>>+1 ; Length (text) )
That's it just the two functions!
There is an alternate method with 'values', but see if you understand the negative for a "start" in the position first.
Sent from miPhone
Thanks Phil, I see your point and for integrity I will use it. Although for my purposes the other way works fine as the "." will only occur once in this example. consider it done. and yes it works well.
Thanks Beverly, Yes I saw the example and have instigated that. On a further note though and one which you could throw a pointer at. Using the above -1 function if i had a directory listing say e.g. C:/Users/Peter/Documents/topline/Form 20XX Site Induction Brief.doc I have determined by the use of 2 separate calc fields (one using -1 and one using -2 that the topline sub directory name falls between characters 25 and 33 how do i extract characters 26-32 in this case now that i am using 2 calc fields?
I am curious. In a couple of places you have mentioned a difficulty due to the text your are parsing being a full directory listing. Do you realise you can extract just the filename? Thus—
GetContainerAttribute ( <tableName::containerField> ; "Filename" )
It would be a much simpler starting point.
Thanks keywords. Yes i am aware i can extract just the filename. However, I am breaking down the directory listing into pieces for a particular reason that has been requested thus my questions. Personally, I think it is unnecessary and would save me all this messing around however, the person making the request is adamant and they have their reasons for it which they will not budge on again, thanks for the reply.
Middle () uses a start & the number of characters.
Sent from miPhone
This should get the extension no matter how long it is, no counting needed.
RightWords (Substitute ( GetContainerAttribute ( ContainerID ; "filename" ) ; "."; " "); 1)
The only thing that needs changed is ContainerID, it will work in field calculation or script.
yes, but the OP wanted other "parts" separated by 'dot' as well. Better to learn the Position() Middle() functions for the sake of learning a useful method. Along with PatternCount(), I can parse just about anything.
Once that's understood, we can introduce all the "value" functions for another method of extracting parts of text...
And i have seen file names with more than one period in them. Not a good practice but it is done.