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.
techdlAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Kurt ReinhardtConnect With a Mentor Sr. 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):

(
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
 
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 :-)

~Kurt
0
 
techdlAuthor Commented:
It's a parameter field. I am currently using CR 8.5. Will the same answer apply to a parameter field?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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?

~Kurt
0
 
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.
0
 
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).

~Kurt
0
 
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.
0
All Courses

From novice to tech pro — start learning today.