Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combine Parameters in Crystal 8.5 1

Status
Not open for further replies.

ready4data

Programmer
Apr 9, 2001
18
US
Is there a way to combine 2 fields in a parameter. We have a lot of accounts that have the same name. The only way to search and get the exact one you need would be to use their name and the city. Can this be done?
Thanks,
scott
 
You can populate the default values with {Name} & " in " & {City} (using export to text and import from file cycle).

Then in the record selection formula, parse the 2 components out and apply the selection logic.

Cheers,
- Ido



CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido,
Sorry I forgot to mention that Account name and city are in two different tables.
Don't know what you mean by:
using export to text and import from file cycle

How would I get AccountName/City to display in the default values of the parameter list?
Thanks,
Scott
 
Create a report just for the purpose of exporting the information to a text file. Then import the file into your Default Parameter Values.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ok, I imported a list into the default values in the parameter field. They look like:
companyxyz in charlotte
companyiny in seattle
companyttf in atlanta
...etc
the formula I have in the select expert is:
{HISTORY.ACCOUNTNAME} = Mid({?Dealer},1,(InStr({?Dealer}," in ")-2)) and
{ADDRESS.CITY}= Mid({?Dealer},InStr({?Dealer}, " in ")+4,Len({?Dealer}))
I had to use "space in space" because some of the company names had an in in them.
after running the report I get 0 results. The 2 tabels are joined properly because if I place those 2 fields on a report I get results returned.
Is there somethinng wrong with my formula?

Scott
 
Try:

{HISTORY.ACCOUNTNAME} = left({?Dealer},(InStr({?Dealer}," in ")-1))
and
{ADDRESS.CITY}= Mid({?Dealer},InStr({?Dealer}, " in ")+4)

-k
 
K,
Thanks
That worked. can you explain why the Mid function didn't work for the account name but workes for city.

Scott
 
It will work for either, you had a logic error.

{HISTORY.ACCOUNTNAME} = Mid({?Dealer},1,(InStr({?Dealer}," in ")-2))

should be:

{HISTORY.ACCOUNTNAME} = Mid({?Dealer},1,(InStr({?Dealer}," in ")-1))

-1 as you just want to go back one character.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top