By using this website, you agree to our Terms of Use (click here)
Hello all!
I searched for this and couldn't find any results so I was hoping someone here could help.
I was inspired by this helpful post by Tim Rodman to create a column for attached files.
In it he mentions using a formula to only select the file name rather than the entire path. I liked that idea so I tried to look for the backslash character '\' but of course that is used as an arithmetic operator so it fails validation and causes an error on the page.
For now I am using the first formula below but wanted to find out how I could search for a backslash character in the filename rather than the parenthesis which would be possible to find in a file name.
I created this GI formula:
=Right( [UploadFile.Name], len([UploadFile.Name])-InStrRev( [UploadFile.Name], ')' )-2)
I would like it to be like this (but whatever would actually search for the backslash instead of causing an error).
=Right( [UploadFile.Name], len([UploadFile.Name])-InStrRev( [UploadFile.Name], '\' )-1)
How can an InStr formula find a backslash or other special character? (Examples: + - * / %)
Thank you!
You are SOOOOO close. You have to "escape" a special character with a backslash. By "escape", I mean that you put the backslash before the special character. If you want a backslash, then put a backslash, then another backslash.
Like this:
=Right( [UploadFile.Name], len([UploadFile.Name])-InStrRev( [UploadFile.Name], '\\' )-1)
I tried this in my environment and I had some files that didn't have a backslash, so I did these formulas:
=InStrRev( [UploadFile.Name], '\\' ) =IIf(len([UploadFile.Name])=InStrRev( [UploadFile.Name], '\\' ),'Not Found',Right( [UploadFile.Name], len([UploadFile.Name])-InStrRev( [UploadFile.Name], '\\' )-1))
Which yielded these results: