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!

Help a complete beginner

Status
Not open for further replies.

Ratatatech

Technical User
Jun 14, 2013
2
US
Hello,

The company I work for recently lost its crystal reporting guy and I have been given his responsibilities with no training and no experience. I plan to pick up a book and learn traditionally but I have an urgent issue and I was hoping someone would be willing to help. I pre-apologize if I'm way off on anything, but I think I’m on the right path.

The basic issue is generally this report will display a number with a unit type (ex. 7% or 2.1g). However, occasionally the value is going to “None detected” or “NR”. When that happens I want the report to omit the unit type. (I don’t want it to say “NR%”) This report already does this for “None Detect”. I need to amend it to accomplish this for NR as well. I think I found the code that relates to this and it’s probably super simple for someone who knows this stuff but I’m a network guy not a programmer and have never used crystal reports before. This is done in Crystal Reports 2008 and the code is below. Any help, guidance, or info would be greatly appreciated. Thank you.


//Changed on 24May11 from {RESULT_SPEC.REPORTED_VALUE} to {RESULT.FORMATTED_ENTRY} to accommodate
//List entry results i.e No_Growth --> No Growth

//added on 06Jun2011

//if {TEST.ANALYSIS} = "RELATED_SUBSTANCES" and {RESULT.FORMATTED_ENTRY} = "0.00" then "None Detected"

//added on 15Aug2011

//if {@Result_TestList} = true and
// {RESULT.FORMATTED_ENTRY} = "0.0"
// or {RESULT.FORMATTED_ENTRY} = "0.00"
// or {RESULT.FORMATTED_ENTRY} = "0.000"
// then "None Detected"
if {RESULT.FORMATTED_ENTRY} = "None Detected" then {RESULT.FORMATTED_ENTRY}
//New code ends

else if {PRODUCT_SPEC.RULE_TYPE} = "T" and {RESULT.IN_SPEC} = "T"
then {RESULT.FORMATTED_ENTRY}

else if {PRODUCT_SPEC.RULE_TYPE} = "T" and {RESULT.IN_SPEC} = "F"
then {RESULT.FORMATTED_ENTRY} & "***"

else if {PRODUCT_SPEC.RULE_TYPE} = "N" and {PRODUCT_SPEC.UNITS} = "None"
and {RESULT.IN_SPEC} = "T" then {RESULT.FORMATTED_ENTRY}

else if {PRODUCT_SPEC.RULE_TYPE} = "N" and {PRODUCT_SPEC.UNITS} = "None"
and {RESULT.IN_SPEC} = "F" then {RESULT.FORMATTED_ENTRY} & "***"

else if {PRODUCT_SPEC.RULE_TYPE} = "N" and {PRODUCT_SPEC.UNITS} <> "None"
and {RESULT.IN_SPEC} = "T" then {RESULT.FORMATTED_ENTRY} & " " & {UNITS.DISPLAY_STRING}

else if {PRODUCT_SPEC.RULE_TYPE} = "N" and {PRODUCT_SPEC.UNITS} <> "None"
and {RESULT.IN_SPEC} = "F" then {RESULT.FORMATTED_ENTRY} & " " & {UNITS.DISPLAY_STRING} & "***"

//
else if {PRODUCT_SPEC.RULE_TYPE} = "F" and {PRODUCT_SPEC.UNITS} = "None"
and {RESULT.IN_SPEC} = "T" then {RESULT.FORMATTED_ENTRY}

else if {PRODUCT_SPEC.RULE_TYPE} = "F" and {PRODUCT_SPEC.UNITS} = "None"
and {RESULT.IN_SPEC} = "F" then {RESULT.FORMATTED_ENTRY} & "***"

else if {PRODUCT_SPEC.RULE_TYPE} = "F" and {PRODUCT_SPEC.UNITS} <> "None"
and {RESULT.IN_SPEC} = "T" then {RESULT_SPEC.REPORTED_VALUE} & " " & {UNITS.DISPLAY_STRING}

else if {PRODUCT_SPEC.RULE_TYPE} = "F" and {PRODUCT_SPEC.UNITS} <> "None"
and {RESULT.IN_SPEC} = "F" then {RESULT_SPEC.REPORTED_VALUE} & " " & {UNITS.DISPLAY_STRING} & "***"

 
This might be your answer. Just added the last line in the block below

Code:
//added on 15Aug2011

//if {@Result_TestList} = true and
// {RESULT.FORMATTED_ENTRY} = "0.0"
// or {RESULT.FORMATTED_ENTRY} = "0.00"
// or {RESULT.FORMATTED_ENTRY} = "0.000"
// then "None Detected"
if {RESULT.FORMATTED_ENTRY} = "None Detected" then {RESULT.FORMATTED_ENTRY}
//New code ends
//Newer code begins
else if {RESULT.FORMATTED_ENTRY} = "NR" then {RESULT.FORMATTED_ENTRY}
<<more code follows>>
or
Code:
if {RESULT.FORMATTED_ENTRY} = "None Detected" or {RESULT.FORMATTED_ENTRY} = "NR" then {RESULT.FORMATTED_ENTRY}
//New code ends
 
I used the first one. The newer code begins made me laugh. Worked perfectly. Thank you very much pmsawyer!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top