November 22, 201213 yr I saw some posts regarding extracting file name and path from a container What I need is a little different: I have a container field (FM Pro 11 Advanced) with a link to external files. I need to find a way to extract the file extension. The path and the name itself are totally useless for what I want to do. Then I need to capture that info inside a script that would go like this: Case extension is .jpg extract content then open the file Case extension is .doc extract content then open the file Case extension is .pdf extract content then open the file etc End case What I'm trying to do, is to be able to open the file by double clicking on the container field whatever the type of the file inside. Using ''extract content'' I can do it say for any PDF file, but that container will also be used for many other types of file. The easy way to have all this, would be to upgrade to FM 12, but it is a costly upgrade for what little I need. I fumbled a lot with the getastext function combined with substring functions without even coming close to a result. Can someone help me with this? I have little experience with scripts and formulas.
November 22, 201213 yr Try = Let ( [ path = GetAsText ( Containerfield ) ; len = Length ( path ) ; pos = Position ( path ; "." ; len ; -1 ) ] ; Right ( path ; len - pos ) ) Of course, if the extension is always 3 characters long, you could do just = Right ( Containerfield ; 3 ) Edited November 22, 201213 yr by comment
November 22, 201213 yr Author Thank you for your help. This is exactly what I needed. Now I can open any type of file just by clicking the container field. SD
Create an account or sign in to comment