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!

is it possible to creat a prompt from two different fields

Status
Not open for further replies.

jschill2628

Programmer
Nov 3, 2009
156
US
I have a formula:
@severity:

If {IRSCLAIM.COVERAGE}= "FALL" and {IRSCLAIM.SPECIAL20} = "05" then "Fall - None" else
If {IRSCLAIM.COVERAGE}= "FALL" and {IRSCLAIM.SPECIAL20} = "10" then "Fall - Minor" else
If {IRSCLAIM.COVERAGE}= "FALL" and {IRSCLAIM.SPECIAL20} = "15" then "Fall - Moderate" else
If {IRSCLAIM.COVERAGE}= "FALL" and {IRSCLAIM.SPECIAL20} = "20" then "Fall - Major" else
If {IRSCLAIM.COVERAGE}= "FALL" and {IRSCLAIM.SPECIAL20} = "25" then "Fall - Death" else

If {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "00" then "Near Miss" else
If {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "01" then "No Harm" else
If {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "02" then "No Detectable Harm" else
If {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "03" then "Minimal - Temporary Harm" else
If {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "04" then "Minimal - Permanent Harm" else
If {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "05" then "Moderate - Temporary Harm" else
If {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "06" then "Moderate - Permanent Harm" else
If {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "07" then "Severe - Temporary Harm" else
If {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "08" then "Severe - Permanent Harm" else
If {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "09" then "Death" else

If {IRSCLAIMSA1.SA153} = "" then "N/A"

I would like to some how make this into a prompt, allowing users to pick all of a select few of the severities found above. I am not sure how to do this especially with two different fields that make up the severity field.

Can anyone help me? Thank you
 
Yes, this can be done. You'll create a static list of possible values for the parameter. Then

1. Go to the record selection expert. If you have not yet selected any fields for record selection, choose any field - we're going to edit the formula so it doesn't make any difference what you select.

2. When the select expert appears, click on the "Show Formula" button and then on the "Formula Workshop button.

3. In the formula editor you have two possible options:

(A) Type in something like {@severity} = {?MySeverityParam}. The problem with doing this is that this filter will NOT be run on the database as part of the SQL. Instead, Crystal will load all of the data into memory and then filter it. This could significantly affect the speed of the report. If it's a small data set, then there shouldn't be too much of a speed hit with using ths method.

(B) To push the select criteria down to the datbase to handle speed issues with a larger dataset, essentially do the reverse of your formula to push the filter processing down to the database. This will look something like this (note where I put the parentheses - these are important!):

(({@MySeverityParam} = "Fall - None" and {IRSCLAIM.COVERAGE}= "FALL" and {IRSCLAIM.SPECIAL20} = "05")
or
(({@MySeverityParam} = "Fall - Minor" and {IRSCLAIM.COVERAGE}= "FALL" and {IRSCLAIM.SPECIAL20} = "10")
or
({@MySeverityParam} = "Fall - Moderate" and {IRSCLAIM.COVERAGE}= "FALL" and {IRSCLAIM.SPECIAL20} = "15")
or
({@MySeverityParam} = "Fall - Major" and {IRSCLAIM.COVERAGE}= "FALL" and {IRSCLAIM.SPECIAL20} = "20")
or
({@MySeverityParam} = "Fall - Death" and {IRSCLAIM.COVERAGE}= "FALL" and {IRSCLAIM.SPECIAL20} = "25")
or
({@MySeverityParam} = "Near Miss" and {IRSCLAIM.COVERAGE} in ["ADR", "BEH", "EQUI", "IVBP", "LAB", "MAT", "MED", "PCE", "SURG"] and {IRSCLAIMSA1.SA153} = "00")
or
(<the rest of your conditions))

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
so the above did not work for me :(

but I do have the following in the selection criteria:

({?Severity} = {IRSCLAIM.SPECIAL20} or {?Severity} = {IRSCLAIMSA1.SA153})

the only problem with the above statement is that it is only pulling the values from "special20", adn the same if I were to reverse it, it is only pulling the values (or incidnets that meet that criteria) from the first field, is there a way to fix this?
 
The problem is that your {?Severity} parameter stands for a combination of the two fields.

I have some thoughts about another way to handle this. Are you using tables or a command for your report?

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top