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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pull specific values from a data field? 1

Status
Not open for further replies.

texusgirl

Programmer
Aug 17, 2003
17
US
Hey Everyone!

I have a question on how to pull values from one data field in order to use them in two different fields. Example:

2(5698)

I need to use the 2 in one field and the (5698) in another. Any suggestions?

thanks in advance
texusgirl
 
Do all the fields you want to split look like this?
If so use 2 formula fields:

@frst:
left({mytable.myfield},1)

@secnd
mid({mytable.myfield},2)
 
Thanks sooo much lupins46! Worked like a charm...all the fields did not look like this but I did a little if then statement and whahla it worked! I am new to crystal so you will probably be hearing from me again. This is a great site.[smile2]
 
You don't really need an if/then/else, if you check out the InStr function.

Changing the @second formula to:

Mid({YourField},InStr({YourField},'(')+1,Length({YourField})-1)

will always return what's in the brackets, no matter what the value before the brackets is.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top