Jump to content
Server Maintenance This Week. ×

Extracting text of variable length


This topic is 6590 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a text field in a database with 1200 records containing 3 lines of text:

First Name Last Name

Street

City, State, Zip

I need to extract just the Street name which has variable number of words of different lengths. What text function or script would be best to use?

Thanks

Link to comment
Share on other sites

Welcome to Forums!!

Try this:

MiddleValues ( textField ; 2 ; 1 )

If you wish to set another field with this value, you can use Replace Field Contents (if not being served at the time) or script. If Replace Contents, just enter this calc in the 'Replace with Calculated Result' after putting your cursor in the new field. If by script, use:

Go To Record/Request [ First ]

Loop

Set Field [ newField ; MiddleValues ( textField ; 2 ; 1 ) ]

Go To Record/Request [ Exit after Last ; Next ]

End Loop

LaRetta :wink2:

Link to comment
Share on other sites

Well ... that was messy of me. It leaves a hard return at the end so you'll need to remove it. Sorry for my error - I didn't expect that MiddleValues() wouldn't clean itself up ... and we don't want to leave junk in your fields!!

Substitute ( MiddleValues ( textField ; 2 ; 1 ) ; ¶ ; "" )

Link to comment
Share on other sites

Well you could simply run my second calc through again on the new field. Or - JUST to remove carriage return at the end, try:

Substitute ( newText ; ¶ ; "" )

And yes, I agree FM Forums is an excellent resource. But as I've just proved, it's recommended that one backs up first before applying ANY process such as this. :wink2:

Just general information ... with vs. 8 there is a more effective method than MiddleValues(). This would have ALSO removed the carriage return at the end. I see your on vs. 7 but I wanted to remind everyone about this new, wonderful function.

GetValue( textField; 2)

LaRetta

Link to comment
Share on other sites

This topic is 6590 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.