Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Tips and Tricks
Message Icon Topic: Finding one letter in a string Post Reply Post New Topic
Author Message
AmyTheJoy
Newbie
Newbie
Avatar

Joined: 03 Sep 2013
Online Status: Offline
Posts: 6
Quote AmyTheJoy Replybullet Topic: Finding one letter in a string
    Posted: 03 Sep 2013 at 12:02pm
Hello,

I need a formula I can use to find a "P" at the end of a string. That is, if I have samples 99991 99992 99993 99994 99995P and 99996, I want to be able to write a formula that will give me "P" as an answer when it sees 99995P. I need to eliminate the rest of the string data... or write an If-Then statement that gives me a "P" when it sees that letter. It gets trickier, because I do not know how many digits a sample might have. It may be 444 445 446P 4447, or 11111112 11111113P 11111114 etc.

Can somebody assist?

Edited by AmyTheJoy - 03 Sep 2013 at 12:02pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Sep 2013 at 4:07am
not sure i fully understand what you want it to do but you can easliy find if the string has a P in it using instr().
instr(field,"P")>0
IP IP Logged
AmyTheJoy
Newbie
Newbie
Avatar

Joined: 03 Sep 2013
Online Status: Offline
Posts: 6
Quote AmyTheJoy Replybullet Posted: 04 Sep 2013 at 4:56am
Actually, what you just gave me was all that I needed. Thanks a ton. I used this formula to find "P", and then I wrote another formula based on whether that first formula gave a True or False answer. And it works great. Thanks!

Edited by AmyTheJoy - 04 Sep 2013 at 4:58am
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.