Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: format last 3 letters Post Reply Post New Topic
Author Message
reddy1868
Newbie
Newbie


Joined: 20 May 2010
Online Status: Offline
Posts: 5
Quote reddy1868 Replybullet Topic: format last 3 letters
     Posted: 04 Jun 2010 at 11:20am

How to convert a field with the following string "Wip Tech Inc" in to "Wip Tech INC) in crystal ? Any help is appreciated.

IP IP Logged
sireeshareddyma
Newbie
Newbie


Joined: 04 Jun 2010
Location: United Kingdom
Online Status: Offline
Posts: 1
Quote sireeshareddyma Replybullet Posted: 04 Jun 2010 at 11:34am
As fas as I know  changing only the last 3 letters in a word is not possible in Crystal Reports.
 
 
 
siri.
 
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 04 Jun 2010 at 12:23pm

You probably have to use a formula to strip off the rightmost characters and then add back in what you wanted.

IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 06 Jun 2010 at 8:57pm
result from formula below (LASTSPACE) is to check the last position of " "(space) from word/text.
if there is no " "(space) then the result will be '-1'.
 
and you can create another formula (LASTWORD) in order to format as your requests (make it uppercase, etc.)
 
----------------------
Formula LASTSPACE:
 
Dim inString
inString = {ThirdParty_ItmMaster;1.ITEMDESC}
Dim i, strLen
i = len(inString)
strLen = Len (inString)
formula = -1
Do While i>0 and formula=-1
   Dim c As String
    if strLen<>0 then
        c = Mid (inString, i, 1)
        if c=" " then formula=i
    end if
    i = i - 1
Loop
----------------------
 
Formula LASTWORD:
if {@lastspace}>0 then uppercase(mid({text_var},{@lastspace}+1))
 
-----------------------
 
 
 
hope it help.
 


Edited by Emir_W - 06 Jun 2010 at 9:00pm
Emir W
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