Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Trim name problem - Crystal 2003 Post Reply Post New Topic
Author Message
Krazy Kasper
Newbie
Newbie
Avatar

Joined: 11 Jul 2007
Location: United States
Online Status: Offline
Posts: 23
Quote Krazy Kasper Replybullet Topic: Trim name problem - Crystal 2003
    Posted: 14 Jan 2009 at 6:46am

The Order Rep Names in my ODBC table appear as:

Lastname, Firstname OR Lastname, Mi. Firstname

I need to change them in my Crystal report to appear as:

Firstname Mi. Lastname

When I do the same thing in a VBA report my code is:

Function ParseFirstComp(OrderRepName) As String
ParseFirstComp = "" 'set the default return value
If Not IsNull(OrderRepName) Then
  Dim LPosition As Integer
  'Find postion of space
  LPosition = InStr(OrderRepName, " ")
  'Return the portion of the string before the space
  If LPosition > 0 Then
    ParseFirstComp = Left(OrderRepName, LPosition - 2)
  End If
End If
End Function

Function ParseSecondComp(OrderRepName) As String
ParseSecondComp = "" 'set the default return value
If Not IsNull(OrderRepName) Then
  Dim LPosition As Integer
  'Find postion of space
  LPosition = InStr(OrderRepName, " ")
  'Return the portion of the string after the space
  If LPosition > 0 Then
    ParseSecondComp = Mid(OrderRepName, LPosition + 1)
  End If
End If
End Function

And then in my query:

Trim ({OptimizeIt.OrderRepName}) ([Expr2] & "  " & [Expr1])

Can someone provide me the code so I can do the same in my Crystal Report? I expect I would put the code in a formula.

Thanks,

 

Krazy Kasper
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.016 seconds.