Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Crystal String Functions

Crystal String Functions

Ratings: (0)|Views: 16,965 |Likes:
Published by Arham Mlari

More info:

Published by: Arham Mlari on Jul 13, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





Reporting Formulas Cheat Sheet bywww.CrystalReportsOnlineTraining.comReporting Formulas Cheat Sheet bywww.CrystalReportsOnlineTraining.com
Report Formulas Cheat SheetsbyCrystal Reports Online Training
All rights reserved. No part of this book may be reproduced, stored in a retrieval system or transmitted in anyform or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews.
The author and publisher have made every effort to ensure the accuracy of the information herein. However,the information contained in this book is sold without warranty, either express or implied. Neither the authorsand Crystal Reports Online Training, nor its dealers or distributors, will be held liable for any damagescaused either directly or indirectly by the instructions contained in this book, or by the software or hardwareproducts described herein.
Reporting Formulas Cheat Sheet bywww.CrystalReportsOnlineTraining.com
String Functions
String Analysis Functions
Function Name Description
AscW(str)Returns the ASCII value of acharacter.ChrW(val)Returns the characterequivalent of an ASCII value.Len(str)Gets the number of charactersin the string.IsNumeric(str)Tells if the string can beproperly converted to anumber.InStr(start,str1, str2,compare)Determines if str2 is a sub-string of str1. The start andcompare arguments are bothoptional.InStrRev(start,str1,str2, compare)Same as InStr() except that itstarts at the end of the stringand searches towards thebeginning.StrCmp(str1, str2,compare)Compares two strings to eachother. The compare argumentis optional.Val(str)Returns the numericequivalent of the string.The StrCmp() function returns a value basedupon how the two strings compare to eachother. Just like the Instr() functions, you canpass a compare argument to set casesensitivity.
StrCmp(str1, str2) Return Values
Return Value Description
-1str1 < str20str1 = str21str1 > str2
String Parsing Functions
Trim(str)Trim the spaces from both sides of astring.LTrim(str)Trim the spaces from the left side ofa string.RTrim(str)Trim the spaces from the right sideof a string.Mid(str, start,length)Return a given number of charactersstarting at a specified position. The
arguments areoptional.Left(str, length)Return a given number of charactersstarting with the leftmost character.Right(str,length)Return a given number of charactersstarting with the rightmost character.The Trim() function deletes all extraneousspaces from either side of the string, dependingon which function you call. The Mid(), Left(),and Right() functions return a partial stringwhere the number of characters returned isbased on the length argument. If you don’tpass a length argument to the Mid() function, itreturns all characters starting with the first oneyou specified.Reporting Formulas Cheat Sheet bywww.CrystalReportsOnlineTraining.com
Reporting Formulas Cheat Sheet bywww.CrystalReportsOnlineTraining.com
String Manipulation Functions
It is common for a string to be modified beforeit is displayed on a report. This can consist ofreformatting the string or even joining thedifferent elements of an array into a singlestring.
String Manipulation Functions
Function Name Description
&, +Concatenate(combine) twostrings into a single string.Filter(str, find, include,compare)Search an array of stringsfor a sub-string and returnan array matching thecriteria.Replace(str, find,replace, start,count, compare)Find a string and replace itwith another string. Thearguments
are all optional.StrReverse(str)Reverse the order of allcharacters in the string.ReplicateString(str,copies)Returns multiple copies of astring.Space(val)Returns the specifiednumber of spaces as a singlestring.Join(list, delimiter)Join an array of strings intoone string and separate themwith the specified delimiter.Split(str, delimiter,count, compare)Split a single string into anarray of strings based uponthe specified delimiter.Thearguments
are optional.Picture(str,template)Formats the characters in astring onto a template.The & or + is used between two stringvariables (or fields) to combine them into asingle string. An example is:
{Customer.LastName} & ", " & {Customer.FirstName};
Although you can use + to concatenatestrings,it is recommended that you use & because it ismost commonly recognized as the standardoperator for concatenating strings. Using + canbe confused with arithmetic functions.An easy way to insert the quote into a string isto use the ChrW(39) function. This returns thequote literal and it is much easier to read.
 // Display "Ben Hur"Chrw(34) & "Ben Hur" & Chrw(34)
The Filter() function searches an array ofstrings for a matching sub-string. It returns anarray of all the strings that have that sub-stringin them. The first argument is the string arrayand the second argument is the sub-string tosearch for. The Filter() function has an optionalinclude argument that tells the function toreturn an array of strings that don’t match thesub-string. Essentially, this would be the sameas saying that it returns all strings where theInStr() function returns a zero.The Replace() function searches for a sub-string within another string, and if it finds it,then it replaces it with the new string. It usesan additional optional argument called count.The count argument lets you limit how manystring replacements are done. If you pass anumber for this argument, then the number ofreplacements done cannot exceed that value. Ifyou don’t pass a value for this argument, thenall the sub-strings are replaced.The Split() and Join() functions work togethernicely. The Split() function takes a string andsplits it into a string array. The string isseparated based upon a character you pass tothe function. This is typically a comma, but itcan be anything you need it to be. Splitting thestring apart makes it is easy to work on theindividual strings. After you are done makingany necessary changes to the individualstrings, you can combine them back into onestring using the Join() function. Howconvenient!Reporting Formulas Cheat Sheet bywww.CrystalReportsOnlineTraining.com

Activity (18)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Joel Aguirre liked this
marianenew liked this
Kennedy Hayford added this note
This is very helpful.
ORPARE liked this
Zeus Hiew liked this
Zeus Hiew liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->