Print Page | Close Window

Split function

Printed From: Crystal Reports Book
Category: General Information
Forum Name: Announcements
Forum Discription: Please check this section for the latest announcements from Crystal Reports Forum
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=11134
Printed Date: 16 May 2024 at 9:42pm


Topic: Split function
Posted By: guessme
Subject: Split function
Date 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




Replies:
Posted By: swigartd
Date Posted: 20 Sep 2010 at 4:00am
Try the following forumas:
Base:  "/XYZ/ABC/NOW/1433.rpt/"
Loc1:  InStrRev ( mailto:%7b@base%7d,/,len%28%7b@base%7d%29-1 - {@base},"/",len({@base})-1 )-1
Base 1:  Mid ( mailto:%7b@base%7d,1 - {@base},1 ,{@Loc1} )
 
Dave


-------------
Aiming beyond mediocrity


Posted By: guessme
Date 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.



Posted By: swigartd
Date 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 ( mailto:%7b@FolderPath2%7d,/,2%29%5b1 - {@FolderPath2},"/",2)[1 ]
The second is like it... Split ( mailto:%7b@FolderPath2%7d,/%29%5b2 - {@FolderPath2},"/")[2 ]  In your second example it would contain "User Folders"
the third would be Split ( mailto:%7b@FolderPath2%7d,/%29%5b3 - {@FolderPath2},"/")[3 ]  It would contain  "ABC"
the fourth would be Split ( mailto:%7b@FolderPath2%7d,/%29%5b4 - {@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



Print Page | Close Window