views:

30

answers:

2

I have a field there in my report its called result. It shows something like that PASS PASS PASS PASS

or

PASS FAIL PASS PASS

I want to make a custom formula to show grand result. If that specific(result) field keeps all PASS value then it will show PASS there in grand result else it will show FAIL(If result field keeps at least one fail value.) I don't have enough idea about crystal report scripting so would you please show me example? I have used following code if {res_info.res} = "PASS" then "PASS" else "FAIL" but it shows pass if last row gets pass value & shows fail if last row gets fail value. All I want to do it that it will check all values of result field & if it gets at least one fail value grand result will show fail else it will show pass. I am just a beginner so please add example with your answer.

A: 

You can keep a second variable that instead of storing either "PASS" or "FAIL", it will store 0 for "Pass" and 1 for "Fail".

Then, in the grand total, you can create a formula field that takes the SUM of your variable, and if it is greater than 0, show "Fail"; otherwise, show "Pass".

LittleBobbyTables
+1  A: 

There are a few ways to accomplish this. The quick and dirty way is to add a Summary field. Right-click on your result field and select "Insert" then "Summary". Select the minimum aggregate function under "Calculate this summary" and select "Grand Total (Report Footer)".

This will return the minimum value for that field (in the case of a string, the minimum in alphabetical order which is FAIL if it appears, otherwise PASS) for all records.

I'm on Crystal Reports 2008, so your version's steps might be slightly different.

Ryan
THANKS A LOT!!! THANKS A LOT! THANKS A LOT!
James