Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal Report Function Post Reply Post New Topic
Author Message
guessme
Newbie
Newbie


Joined: 17 Sep 2010
Online Status: Offline
Posts: 4
Quote guessme Replybullet Topic: Crystal Report Function
     Posted: 27 Sep 2010 at 6:18am

Good Day,

I have a field in my database called Command.Detail_TEXT. This field contains folderpath

Example 1

/Report Samples/Financial/

Example 2

/User Folders/ABC/Emergency_SIT_Reconciliation Summary.rpt /

Example 3
/BOE Administration/Business Objects Report Failures/

There are records that will not have rpt file name in the folder path (Example 1) and sometimes there are records which will have the rpt file name in the folder path.(Example 2)

There are case records which will have the rpt file name in the folder path but there will not be an extension of .rpt at the end (example 3 where Business Objects Report Failures is an rpt file )


I want to be able to record which records have rpt file name in the Command.Detail_TEXT field and which records do not.

If a record has rpt file name  in the Command.Detail_TEXT field, i would like it to be removed from the path name and display only the folder(s) name .

If a record does not have rpt file name in the Command.Detail_TEXT field, I would like it to be displayed as it is in the report

For example :

/BOE Administration/Business Objects Report Failures/ should be /BOE Administration

/User Folders/ABC/Emergency_SIT_Reconciliation Summary.rpt /   should be /User Folders/ABC

/Report Samples/Financial/   should remain as it is  /Report Samples/Financial/


What formula can I use to do this.

I am using Crystal Reports 2008 with a Oracle  database.

Thanks!



Edited by guessme - 27 Sep 2010 at 11:10am
IP IP Logged
guessme
Newbie
Newbie


Joined: 17 Sep 2010
Online Status: Offline
Posts: 4
Quote guessme Replybullet Posted: 27 Sep 2010 at 11:02am

Does anybody know how to write this formula.Help greatly appreciated

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Sep 2010 at 11:14am
I am failing to see an definitive repeatable logic that differentiates example 1 from example 3.
can yuo explain how you would you always know the difference between these?
IP IP Logged
rvink
Groupie
Groupie
Avatar

Joined: 04 Feb 2008
Location: New Zealand
Online Status: Offline
Posts: 55
Quote rvink Replybullet Posted: 27 Sep 2010 at 1:08pm
If the file path ends with ".rpt" you can do this:

if {Command.Detail_TEXT} like "*.rpt" then
   left({Command.Detail_TEXT}, InStrRev({Command.Detail_TEXT}, "/")
else
   {Command.Detail_TEXT}

If the file path is a report but does not include "rpt" you cannot do it unless there is other information which tells you it is a report file and not a path.
IP IP Logged
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