Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a calculation/script that extracts text? 1

Status
Not open for further replies.

th201

Technical User
Dec 15, 2003
39
US
I am trying to create a way that allows certain parts of the text to appear in specified fields automatically. Basically, a block of text is copied and pasted into a main field. The text consists of a company name, address, city, zip & phone #. Once the block of text is pasted in the main field, I would like each part of the text to appear in its own field automatically : the address text in a address field, city name appears in the city field and so on. I was able to create a calculation that shows the company name in the specified field but cannot get the other text to do the same. Any suggestions or advice would be welcome.
 
First, make sure your field ends up as a return delimited list.
Play around with a calculation along these lines:

Middle (
text ,
Position ( text , "¶" , 1 , 3 ) + 1 ,
Position ( text , "¶" , 1 , 4 ) - Position ( text , "¶" , 1 , 3 ) - 1
)

Or a more general formula to extract the n-th value in a return-delimited list:

Middle (
text ,
Position ( text , "¶" , 1 , n - 1 ) + 1 ,
Position ( text & "¶" , "¶" , 1 , n ) - Position ( text , "¶" , 1 , n - 1 ) - 1
)

With first control how many ¶ ther are in your text, you can determine the n-value.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top