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!

How to delete a specific part of a text in a function? 1

Status
Not open for further replies.

th201

Technical User
Dec 15, 2003
39
US
What I am trying to do is delete the suite number of an address. However, not all addresses have suite numbers and I haven't figured out a way for the calculation to identify which records to edit and not edit. Each record that has a suite number has a "#" symbol after the address and before the suite number (e.g. 123 w main st # 200). Does anyone know of a way to remove/edit the suite number while leaving the non suite address records unchanged? Any suggestions would be greatly appreciated.
 
Assuming the suite number is the last item in the address field, make a script where you put the addressfield to itself minus every character starting with the # character.

Something along these lines:
Set Field (yourTable::address;

Left ( yourTable::address;
Position ( yourTable::address ; "#" ; 1 ;
PatternCount ( yourTable::address ; "#" ) ) - 1
)

Or use the calc (from the Left on) to make a new calc field with this formula.

If you have a considerable amount of records, consider to put the script in a loop, after you made a foundset of records.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top