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

Creating and USING a Custom Function based on a formula -- CR 9

Status
Not open for further replies.

czarzecki

MIS
Jan 29, 2003
4
US
Hi. I have a formula that converts one string (a code) into another string (an office abbreviation). In Crystal 9, I used the extractor when creating a custom function and I want to use it in multiple reports, so I saved it to the Crystal Repository.

This is the formula:

if {FED_ORGANIZATION.ADMIN_CODE} = "K" then "ACF" else
if {FED_ORGANIZATION.ADMIN_CODE} = "KA" then "OAS" else
IF{FED_ORGANIZATION.ADMIN_CODE} = "KB" then "ACYF" else
if {FED_ORGANIZATION.ADMIN_CODE} = "KBA" then "ACYF" else
if {FED_ORGANIZATION.ADMIN_CODE} = "KBA-" then "ACYF" else
if {FED_ORGANIZATION.ADMIN_CODE} = "KBA-1" then "ACYF" else
IF {FED_ORGANIZATION.ADMIN_CODE} = "KBA1" THEN "ACYF" ELSE
IF {FED_ORGANIZATION.ADMIN_CODE} = "KBA3" THEN "ACYF" ELSE
if {FED_ORGANIZATION.ADMIN_CODE} = "KBB" then "ACYF" else
if {FED_ORGANIZATION.ADMIN_CODE} = "KBB1" then "ACYF" else
if {FED_ORGANIZATION.ADMIN_CODE} = "KBB2" then "ACYF" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KBC" then "HSB" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KBD" then "CB" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KBE" then "FYSB" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KBF" then "NCCAN" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KBG" then "CCB" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KC" then "ADD" else
if {FED_ORGANIZATION.ADMIN_CODE} = "KD" then "RO" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KDX" then "R10" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KD1" then "R01" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KD2" then "R02" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KD3" then "R03" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KD4" then "R04" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KD5" then "R05" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KD6" then "R06" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KD7" then "R07" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KD8" then "R08" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KD9" then "R09" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KE" then "ANA" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KF" then "OCSE" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KG" then "OCS" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KH" then "OFA" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KJ" then "ORO" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KK" then "OA" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KL" then "POL-EXTERN" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KM" then "OPRE" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KN" then "OPA" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KP" then "OA" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KR" then "ORR" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KS" then "EEO" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KT" then "OLAB" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KU" then "OHRM" else
if {FED_ORGANIZATION.ADMIN_CODE} startswith "KV" then "OASFM" else
IF {FED_ORGANIZATION.ADMIN_CODE} = 'KAB' THEN 'OAS/ES' ELSE
IF {FED_ORGANIZATION.ADMIN_CODE} = 'KAB-2' THEN "OAS/ES" ELSE
IF {FED_ORGANIZATION.ADMIN_CODE} = 'KAD' THEN 'PCMR' ELSE
IF {FED_ORGANIZATION.ADMIN_CODE} = 'KAE' THEN 'ABCAN' ELSE
IF {FED_ORGANIZATION.ADMIN_CODE} = 'KAF' THEN 'OAS/EXSEC' ELSE
{FED_ORGANIZATION.ADMIN_CODE}


You can see why I want to save this and reuse it again and again.

Can anyone tell me why, after I've used the extractor, to create a custom function and saved it to the repository, I can't use it? I've tried inserting the function directly into the report and also creating a formula, such as:

Fed_Organization ({FED_ORGANIZATION.ADMIN_CODE}) and inserting that into the report.

I either get an error message or no data.

Thanks.
 
I don't know if you ever got this figured out or not, but in case you didn't...Right click on the function in your repository and click on 'Add to report'. The function needs to reside in the report custom functions to be available within the report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top