String manipulation in Crystal Reports


'Code By Kiran Reddy
'String manipulation, convert a string to a date format
'If the date is stored in your database as a string or a number e.g..20040321 (yyyymmdd), you can convert this in to a proper date e.g dd/mm/yyyy
'Open formula editor and select Basic Syntax from drop down box and add following code

dim str1 as string
dim strday as string
dim strmon as string
dim stryear as string
dim strdate as string
str1 = {YOUR.FIELD}

stryear = left(str1,4)
strday = right(str1,2)
strmon = left(right(str1,4),2)

formula = "Schedule Date: " & strday & "/" & strmon & "/" & stryear


You can view this article online at:
http://www.kiranreddys.com/knowledgebase/index.php/article/string-manipulation-in-crystal-reports