Newbies Edv Posted April 8, 2007 Newbies Posted April 8, 2007 I have been trying to figure out a calculation (for use in a script) that will delete the last character in a text field. I've tried various find/replace with "", and other options, but no luck yet. Replacing/deleting the last character is probably all I would normally need, but replacing/deleting the last character IF that character is "x" would be safer. New to this forum. Skills have gotten kind of rusty with FM. Thanks very much for any tips, pointers to other help files, etc. Ed
Raybaudi Posted April 8, 2007 Posted April 8, 2007 Case( Right ( yourField ; 1 ) = "x" ; Left ( yourField ; Length ( yourField ) - 1 ); yourField )
Newbies Edv Posted April 9, 2007 Author Newbies Posted April 9, 2007 Case( Right ( yourField [color:red]) = "x" ; Left ( yourField ; Length ( yourField ) - 1 ; yourField ) Thanks very much! I tried your suggestion above -- but FM highlighted the first "[color:red])" and said there are too few parameters in this function. So I changed that part to be consistent with: Right ( text ; numberOfCharacters ) Then the calc read: Case( Right ( yourField; 1 ) = "x" ; Left ( yourField ; Length ( yourField ) - 1 [color:red]; yourField ) But FM highlighted the "[color:red];" after the -1 and said "There are too many parameters in this function." I've tried a few things. Probably getting close to a solution, but no success yet. Thanks again! Ed
Stuart Taylor Posted April 9, 2007 Posted April 9, 2007 raybaudi's solution reads: [color:green]Case( Right ( yourField ; 1 ) = "x" ; Left ( yourField ; Length ( yourField ) - 1 ); yourField ) Your first version read: [color:red]Right ( yourField ) = "x" not [color:green]Right ( yourField ; 1 ) = "x" Your second reads: [color:red]Left ( yourField ; Length ( yourField ) - 1 ; instead of: [color:green]Left ( yourField ; Length ( yourField ) - 1 ); ...you missed the bracket off! Just read more carefully or copy and paste it...
LaRetta Posted April 9, 2007 Posted April 9, 2007 It DOES look like a copy/paste. There is also possibility that Danielle corrected it after it was copied. We correct our posts quite often. :wink2:
Stuart Taylor Posted April 9, 2007 Posted April 9, 2007 That is a distinct posibility ... but the error does seem to be right next to "yourField" in both places ... which Edv probably would have changed to fit the calc discussed.
Newbies Edv Posted April 9, 2007 Author Newbies Posted April 9, 2007 Great! It works! Thanks very much to raybaudi(!) and StuartT and LaRetta. Unless I copied and pasted things wrong this is what works for me... [color:blue]Case( Right ( YourField; 1 ) = "x" ; Left (YourField ; Length ( YourField ) - 1 ); YourField ) Thanks again... I am overwhelmed by all the help and hope to give back to the forum when I can! Ed
Recommended Posts
This topic is 6499 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 accountSign in
Already have an account? Sign in here.
Sign In Now