A tilde in my crystal report

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kurt ReinhardtSr. Business Intelligence Consultant/ArchitectCommented:
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 :-)

techdlAuthor Commented:
It's a parameter field. I am currently using CR 8.5. Will the same answer apply to a parameter field?
Kurt ReinhardtSr. Business Intelligence Consultant/ArchitectCommented:
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?

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

techdlAuthor Commented:
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.
Kurt ReinhardtSr. Business Intelligence Consultant/ArchitectCommented:
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).

techdlAuthor Commented:
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.
Kurt ReinhardtSr. Business Intelligence Consultant/ArchitectCommented:
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):

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

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).


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.