Search code examples
crystal-reports

No preview data - how to edit sql?


I am editing a crystal report (using version 14.1.1) report that came with a system we are using. I cannot see any data in the preview but when I go to "Database -> show sql query" it is clear that it doesn't work because the query wants some values that does not exist in the database, just a simple "FIELD = 'value1'" within the query where I would like to have "FIELD = 'value2'"

Where can I set those values?

To be exact, the query is the following beast (don't blame me, this is made by a commersial system) and I need to be able to set another value for ORDER_NUM=

SELECT "ORDERS"."ORDER_NUM", "CUSTOMER"."COMPANY_NAME",    
"CUSTOMER"."ADDRESS1", "CUSTOMER"."ADDRESS2", "ORDERS"."LAB_GROUP",
"ORDERS"."X_INTERNAL_RESP", "ORDERS"."X_CONTACT_PERSON", 
"SAMPLE"."SAMPLE_NUMBER", "SAMPLE"."X_EXTERNAL_ID", "SAMPLE"."SAMPLE_TYPE",  
"SAMPLE"."X_REFERENCE_TIME", "TEST"."ANALYSIS", "RESULT"."NAME", 
"ORDERS"."X_SIGNED_BY", "RESULT"."FORMATTED_ENTRY", "RESULT"."STATUS", 
"RESULT"."ACCREDITED", "UNITS"."DISPLAY_STRING", "TEST"."STATUS",   
"RESULT"."REPORTABLE", "RESULT"."ORDER_NUMBER", "RESULT"."ATTRIBUTE_1",
"RESULT"."ATTRIBUTE_2"
FROM   ((("SAMPLE" INNER JOIN "TEST" ON
"SAMPLE"."SAMPLE_NUMBER"="TEST"."SAMPLE_NUMBER") INNER JOIN ("CUSTOMER" 
INNER JOIN "ORDERS" ON "CUSTOMER"."NAME"="ORDERS"."ABOUT_ENTITY") ON  
"SAMPLE"."X_ORDER"="ORDERS"."ORDER_NUM") INNER JOIN "RESULT" ON 
("TEST"."SAMPLE_NUMBER"="RESULT"."SAMPLE_NUMBER") AND 
"TEST"."TEST_NUMBER"="RESULT"."TEST_NUMBER")) LEFT OUTER JOIN "UNITS" ON 
"RESULT"."UNITS"="UNITS"."UNIT_CODE"
 WHERE  "RESULT"."REPORTABLE"='T' AND "ORDERS"."ORDER_NUM"='ØSTERÅS-2014-79' 
 AND "RESULT"."STATUS"='A' AND "TEST"."STATUS"='A'
 ORDER BY "SAMPLE"."SAMPLE_NUMBER", "TEST"."ANALYSIS", "RESULT"."NAME"

Solution

  • Cannot say exact location for CR 14, but usually in "Report" menu is choice "Selection formulas" - "Record". Conditions into WHERE caluse are usaully inserted from there.