Solved

Crystal Reports Replace Portion of String Starting with

Posted on 2011-02-14
3
821 Views
Last Modified: 2012-05-11
Need to turn variable account name into shortened string.

Example:

Salaries (Global, NF)
Salaries (CP, NF)
Vehicle Repair (Maint, NF)

needs to turn into:

Salaries
Salaries
Vehicle Repair

Replace( dbo.Acctname, "(*", "") and Replace( dbo.Acctname, "*(*", "")
are not working.  Are wildcards recognized in Crystal Replace?  I'm pretty sure I've used wildcard replace in both SQL and access.
0
Comment
Question by:jbrannen333
3 Comments
 
LVL 26

Accepted Solution

by:
Kurt Reinhardt earned 125 total points
ID: 34891007
Local NumberVar leftparen := Instr(dbo.Acctname,"(") - 2;

{dbo.Acctname} [1 to leftparen]

~Kurt
0
 

Author Comment

by:jbrannen333
ID: 34891125
Got  the following to work

Replace(dbo.AcctName, MID(dbo.AcctName, InStr(dbo.Acctname, "(")),"")

rhinok's solution looks a lot cleaner though.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 34891409
You colud also use

Local NumberVar leftparen := Instr(dbo.Acctname,"(") - 2;

Left({dbo.Acctname},leftparen )

mlmcc
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article describes some very basic things about SQL Server filegroups.
Read about achieving the basic levels of HRIS security in the workplace.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now