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

Loops in Formulas

Status
Not open for further replies.

JodyAmy

Programmer
Feb 12, 2001
21
US
Is it possible to use a "for loop" or a "while loop" or something similar to search through a string field for a certain character?

TIA!

Jody
 
Yes, but it would be easier to use the InStr() formula.

If you need repeated search, Crystal gives you several
'Do' and 'For/Next' Loop syntax variations.

Cheers,
- Ido ixm7@psu.edu
 
Thanks Ido, is it then possible to add a character before or after this character I'm searching for. If it was a known number of character then it would be fine, but the field could have any number of entries.

Here is what I'm trying to do:

Current data: 245 12 4789
Desired data: 245, 12, 4789

Very simple idea, but aggravating. I'm thinking I would do a search through the string to the first blank space and record the position number, add the comma, and then put that into a variable and then continue to search throughout the variable. The remaining search is the sticking point.
 
Have a look at the Replace() function.

Something like Replace({your_field}, ' ', ', ')
should do the trick.

Cheers,
- Ido ixm7@psu.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top