kevind
Active Member
   

I was more than willing to "pony up", how b'out U?
Posts: 634
Gender:
|
David, If I understand you correctly, you want to generate a report selection that DOES NOT include anyone that has a class of X assigned. To do this, you use a SQL select called a correlated subquery. To do this correctly, you should be accessing your dba data through an ODBC datasource using the DDF files generated by the off menu program 'ODBCDDF'. This is how you leverage the relational side of the Pervasive database and enjoy the benifits of SQL select statements getting "pushed down" to the server. This is the only method that I use to access DBA datafiles. You also need to use the Visual Linking Expert to link the BKCM_ACCT_CODE field of BKCMACCT to the BKCM_ACCL_CODE field of BKCMACCL with a Left Outer type Join. The arrow of the join should point to the BKCMACCL file. This is key to including entries that do not have any class codes assigned. The bkcmaccl file has an entry for every customer that has class codes assigned. Each record consists of 3 fields, a key field (BKCM_ACCL_KEY) , a customer code field (BKCM_ACCL_CODE) , and a class field (BKCM_ACCL_CLASS). The key field is NOT used at all for this report. The idea in the subquery, is that only customer codes (BKCM_ACCL_CODE) that DO NOT show up in a subquery specification will be included in the report. To do this in crystal reports, you first specify a simple selection critera by clicking the select expert, and set BKCM_ACCL_CODE equal to 'HERE'. This will create an SQL select statement template that we will now edit. If you now click "Show SQL Query" Under "Database", you will see the query that Crystal will send to the database to retrieve a record set. in the Where Clause of that statment, you will see the following: WHERE BKCMACCL."BKCM_ACCL_CODE" = 'HERE' This is the line that we will replace to include a subquery. You need to change the line following the WHERE clause to: BKCMACCL."BKCM_ACCL_CODE" NOT IN ( SELECT DISTINCT CM.BKCM_ACCL_CODE FROM DBADATA.BKCMACCL CM WHERE CM.BKCM_ACCL_CLASS = 'X' ) (Where it says "DBADATA" above, replace it with the name of your ODBC datasource) I have tested this with my datafiles and it works perfectly. Hope this helps.
|