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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I Use A Formula In the Report Export?

Status
Not open for further replies.

ChiTownDiva

Technical User
Jan 24, 2001
273
US
I'm writing a report that has a parameter called {?Location}. It uses a pick list that has states and cities on it (i.e. "AL Birmingham"). The actual data is "ALBIRMIN".

I also created a formula called "Location" to convert the parameter field back to the actual data:

If {?Location} = "Al Birmingham" then crse_session.site_cd is "ALBIRMIN" else
(blah, blah)


For some reason when I use this in the report expert:

crse_session.site_cd like {@Location}

I get an error.

What am I not doing?

Thanks.

ChiTownDiva[ponytails2]
 
You don't specify what error you are getting.

Try using = instead of "like"

crse_session.site_cd = {@Location}


Using "like" is more appropriate is you are looking for "Bob" in the {name} field but your data may contain "Bub"

e.g. {name} like "B?b"
This will bring back Bob, Bub, Bib, Bcb, etc Mike

 
Your formula is wrong, you can not assign a value to crse_session.site_cd, you want your formula Location to return ALBIRMIN

Change to read

If {?Location} = "Al Birmingham" then "ALBIRMIN" else
(blah, blah)

then in the report selector

crse_session.site_cd = {@Location}

This can can now return a true or false, whereas before, the selector could not work out what you were trying to restrict

Ian Waterman
UK Crystal Consultant




 
It's just
Code:
If {?Location} = "Al Birmingham" then "ALBIRMIN" else
...

As Mike mentioned, you don't need 'like' in the selection criteria.

Naith
 
When you say in the report expert, do you mean the select expert? You could create a formula field and place it on your report in the report expert, or you could put a formula in the select expert.

Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top