chevell Posted November 14, 2005 Posted November 14, 2005 I want to divide this text into two seperate fields. "Schofield Barracks/Schofield Barracks" I've got the first part broken out using: Left ( dept_loc; Position ( dept_loc; "/" ; 1 ; 1 ) -1) If I reverse that, for some reason it doesn't work. Here's what I've got: Right ( dept_loc; Position ( dept_loc; "/" ; 1 ; 1 )) Any help would be appreciated.
Raybaudi Posted November 14, 2005 Posted November 14, 2005 Hi the reverse of: Left ( dept_loc; Position ( dept_loc; "/" ; 1 ; 1 ) -1) is: Right ( dept_loc; Position ( dept_loc; "/" ; 1 ; 1 )-1) the "-1" is for deleting the "/" in the left and in the right functions !
chevell Posted November 14, 2005 Author Posted November 14, 2005 Ok, fair enough. The result of: Call Center Hub - Col Springs/Colorado Springs Hub Using: Right ( dept_loc; Position ( dept_loc; "/" ; 1 ; 1 )-1) is: Springs/Colorado Springs Hub Ideas?
comment Posted November 14, 2005 Posted November 14, 2005 The Position() function counts from left. The Right() function counts from right. Try: Right ( dept_loc ; Length ( dept_loc ) - Position ( dept_loc; "/" ; 1 ; 1 ) )
Raybaudi Posted November 15, 2005 Posted November 15, 2005 Hi, of course my calc was right only if the left side and the right side have the same number of chars ! (as in your first example) So comment gives you the correct answer! BTW there is another way to calc the left side and the right side: leftSide: Replace ( text ; Position ( text ; "/" ; 1 ; 1 ) ; Length ( text ) ; "" ) rightSide: Replace ( text ; 1 ; Position ( text ; "/" ; 1 ; 1 ) ; "" )
chevell Posted November 15, 2005 Author Posted November 15, 2005 OK, now I have another field. First and Last name seperated only by a comma and no space. I want to add a space there. (ie "Doe,John" becomes "Doe, John") Ideas? Thanks!
Raybaudi Posted November 15, 2005 Posted November 15, 2005 Yes... this is simpler Substitute ( Name ; "," ; ", " )
Recommended Posts
This topic is 7295 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