Announcements
 Crystal Reports Forum : General Information : Announcements
Message Icon Topic: Split function Post Reply Post New Topic
Author Message
guessme
Newbie
Newbie


Joined: 17 Sep 2010
Online Status: Offline
Posts: 4
Quote guessme Replybullet Topic: Split function
    Posted: 17 Sep 2010 at 9:00am

how to split data in the crystal report formula 

For example 
/XYZ/ABC/NOW/1433.rpt/

becomes
/XYZ/ABC/NOW


/XYZ/Test.rpt

becomes
/XYZ

IP IP Logged
swigartd
Newbie
Newbie
Avatar

Joined: 16 Sep 2010
Location: United States
Online Status: Offline
Posts: 13
Quote swigartd Replybullet Posted: 20 Sep 2010 at 4:00am
Try the following forumas:
Base:  "/XYZ/ABC/NOW/1433.rpt/"
Loc1:  InStrRev ({@base},"/",len({@base})-1 )-1
Base 1:  Mid ({@base},1 ,{@Loc1} )
 
Dave
Aiming beyond mediocrity
IP IP Logged
guessme
Newbie
Newbie


Joined: 17 Sep 2010
Online Status: Offline
Posts: 4
Quote guessme Replybullet Posted: 22 Sep 2010 at 9:21am

I am Using crystal Reports 2008.

This is how the data is :

When a report is in scheduled status then the FolderPath consists of the FolderName as well as the Report Name.This is the case for all scheduled reports

 
FolderPath :  /CustomerDetails/CustomerDetails.rpt/                                                 

Status     :   Scheduled  

ReportName :  CustomerDetails.rpt


FolderPath  : /User Folders/ABC/Emergency_SIT_Reconciliation Summary / 

Status       : Scheduled          

ReportName  : Emergency_SIT_Reconciliation Summary


When a report is in Viewed status then the FolderPath consists of the FolderName only.This is the case for all viewed Reports


FolderPath  :  /Product/ProductInventory/ProductDetails/                                           

Status  :      Viewed 

ReportName  :       New Product Details.rpt


I would like to split the FolderPath in both the status such that i get only the folder and  subfolder name 


Hopefully this helps.

IP IP Logged
swigartd
Newbie
Newbie
Avatar

Joined: 16 Sep 2010
Location: United States
Online Status: Offline
Posts: 13
Quote swigartd Replybullet Posted: 22 Sep 2010 at 11:02am
I would split the string into several variables.
First, which would be empty if the first charactor is a "/" would be Split ({@FolderPath2},"/",2)[1]
The second is like it... Split ({@FolderPath2},"/")[2]  In your second example it would contain "User Folders"
the third would be Split ({@FolderPath2},"/")[3]  It would contain  "ABC"
the fourth would be Split ({@FolderPath2},"/")[4] It would contain "Emergency_SIT_Reconciliation Summary "
 
The problem will come with the number of levels of subfolders that are involved.
 
If you check the length of the Split from last to first.  the first non-zero split that you find will be your file name.  the second will be a folder or subfolder and so forth.
 
Does that help?
 
Kindest regards,
 
Dave
 
 
Aiming beyond mediocrity
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.