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!

Return porion of string before '-'

Status
Not open for further replies.

bluraz

MIS
Aug 18, 2005
32
US
Crystal XI

I have a string field that returns a result of ######-##. (i.e.: 123456-06)
I need a formula to suppress the '-06' and return a result of only '123456'.
I then need another formula to suppress the '123456', and return a vaule of '-06'.

Any help would be very much appreciated. This is the last step to this report and will complete my day!! :)

 
Try:

For the first:
split({table.field},"-")[1]

and for the second:
split({table.field},"-")[2]

-k
 
you will need the instr function to accomplish this. There are examples in the help files.

Something like:

if left(trim({dbfield}, instr({dbfield}, "-")= 0 then
trim({dbfield}, instr({dbfield},"-") else

etc.

Thanks so much!
satinsilhouette
 
synapsevampire

Thank you very much!! Yours worked perfectly, as always!!


satinsilhouette - Thank you for your reply. With the success of synpsevampire's post, I did not try your suggestion.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top