Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

A tilde in my crystal report

Posted on 2004-11-01
7
Medium Priority
?
981 Views
Last Modified: 2012-06-21
I am passing a string to my crystal report from a HTML form. The string contains a lastname,  firstname, for example
"Doe,  John" . On my Crystal Report my parameter looks like Doe~ John. Is there a way to fix this so that Crystal will see my string as "Doe,  John" on the report. If I type the value directly into the report, the parameter displays correctly. Thanks.
0
Comment
Question by:techdl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 12469819
Assuming that you're trying to format the text of a string field that appears on the report, not a parameter field the simplest method is to use the REPLACE function (depending on your version of CR):

Replace({table.field},'~ ',', ')

If you're trying to do something more complex, please reply and we'll assist as best we can :-)

~Kurt
0
 

Author Comment

by:techdl
ID: 12473912
It's a parameter field. I am currently using CR 8.5. Will the same answer apply to a parameter field?
0
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 12473963
When you say:

"On my Crystal Report my parameter looks like Doe~ John"

what do you mean?  Are you displaying the parameter as a field on the report, or do you mean that the tilde is processed as part of your record selection criteria?  What is the root of the issue?

~Kurt
0
Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

 

Author Comment

by:techdl
ID: 12474213
In my web form I have the following:

<select name="promptex-@ApproverName" style="FONT-FAMILY:monospace" id="ApproverName">
                    <option value ="Doe1,  John">Doe1, John</option>
                    <option value ="Doe2,  John">Doe2, John</option>
                    <option value ="Doe3,  John">Doe3, John</option>


When I select a name from my option list, it is passed to my report as a parameter. On my report I am trying to display data based on the @ApproverName, in addition to showing @ApproverName.

Instead of Crystal comparing @ApproverName as Doe1, John
Crystal compares the name from the web form as Doe1~ John. Something is replacing the , with a ~
As a result  @ApproverName displays as Doe1~ John on the Crystal Report, and my data is not coming up as a result of the incorrect parameter. Hope this helps clarify. Thanks.
0
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 12474342
You can use the replace function in your record selection criteria, but it will prevent the data from being passed to the database.  Please post your record selection criteria and we'll see what we can do to get you the right data (hopefully efficiently).

~Kurt
0
 

Author Comment

by:techdl
ID: 12474549
Below is the condition: I am trying to compare Doe1, John in the table, to the parameter Doe1, John being passed from the web form.

{tblName.ApproverName} = {?@ApproverName}

Hope this is what you were looking to see.
0
 
LVL 26

Accepted Solution

by:
Kurt Reinhardt earned 1000 total points
ID: 12476731
in general, I'd say you can use the following:

{tblName.ApproverName} = Replace({?@ApproverName},'~ ',', '), but it's not very efficient.  What db are you using and is this report based upon a stored procedure?

If you're using a SQL-based db (Oracle, SQL Server, etc..), then you could use something like the following (more syntax, but more efficient db processing):

(
If
  Not IsNull({?@ApproverName})
Then
  Replace({?@ApproverName},'~ ',', ')
Else If
  IsNull({?@ApproverName})
Then
  False
)

Basically this code checks to see if the parameter is NULL.  If it is, nothing is returned.  If it isn't, then it changes the tilde to a comma.  In general, MOST Crystal functions won't be passed to the database for processing unless you can embed them in other special fields (like Switch, Choose or IIF) or within an IF-THEN-ELSE IF boolean statement (like above).

~Kurt
 
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

598 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