Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Substring and Instr together Post Reply Post New Topic
Author Message
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Topic: Substring and Instr together
    Posted: 25 Oct 2012 at 4:16am
Hello,

I am having an issue using Substr and Instr and need some help.
right now I have
field:
asdfg - itsnoteasy - whattodo

I don't need - whattodo from the field

I used substr(field, instr(field,'-',1)) as name,
but not working.
Any help is appreciated.

TIA
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Oct 2012 at 4:55am
do you mean you want to return
"asdfg - itsnoteasy"
?
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 25 Oct 2012 at 4:57am
yes and I tried all the combinations after Instr but is not working.

Thank you.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Oct 2012 at 5:07am
mid({table.field},1,instrrev({table.field}," - "))
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 25 Oct 2012 at 5:34am
Thank you but is it possible to use substr and instr as I need this field not as a formula and I am trying to use as a sql in the report.
TIA
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Oct 2012 at 5:45am
I do not understand what you mean by "use as a sql in the report"?
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 25 Oct 2012 at 5:58am
I am using pl/sql to get the fields for this report and this particular field I need as a parameter. I have seen that if it is a formula, Crystal does not show in the list to pick for the parameter.

Thank you

Edited by crystalgal - 25 Oct 2012 at 6:04am
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 25 Oct 2012 at 6:19am
I got by using this.
substr(field,0, instr(field,'-',1,2)-1)

Thank you very much. You are always there/here when I need it.:-)
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.016 seconds.