Click for Index

Section 11
Quick Reports Table

This table allows you to define reports that list table and view data in a very simple format. These listings cab be printed or exported to an Excel spread sheet. You need to know a small amount of SQL in order to create these reports, however, once the report is initially created it can be run over and over again without knowing anything about SQL syntax. Quadrant support can assist you in setting these up the first time.

Each field in the table is listed, along with a short description, below:
  1. REPORT_NAME
    This is the name of the report the user will see on the Quick Reports Screen which is selected from the Reports drop down menu on the Main Menu.

    The reports are listed in alphabetical order, but if you want them to appear in an alternate order, place a numeric value at the start of the report_name field, for example, instead of JOURNAL REPORT, use 001-JOURNAL REPORT to cause this to be the first item listed.
  2. FILE_NAME
    This is the file name for the report if you will output it via a Windows printer to a PDF file. It must be a val file name, and not more than 50 characters long. The reports will be output (if printed to a PDF file) to the c:\programdata (x86)\quadrant\reports directory.
  3. SEC_LEVEL

    This value defines the level of security a user needs to be able to access the report.
  4. SQL_SELECT
    This value defines the actual SQL statement that will be run to generate your report. A very simple sample SQL statement to list the user_ids and names of your cashiers would be something like this:

    select user_id, last_name, first_name from cashiers order by last_name


    The Quick Reports function is designed to allow quick and simple access to a limited number of predefined tables. These tables are listed in the MISCPARMS table under the record keys quick-reports-table-xxx, where xxx is just a sequential number that permits the record to be added as a unique key, for example:
    QUICK-REPORTS-TABLE-001,
    QUICK-REPORTS-TABLE-002, etc.

    These values will be preloaded into the MISCPARMS table automatically when you do a program update.

    When the Quick Reports screen is loaded, it reads the list of QUICK-REPORTS-TABLE-xxx values, and then for each of those tables, it adds the list of column names that are linked to each table. These values are used to validate the entries you make in your sql statements.

    Unfortunately, spelling and punctuation counts when dealing with SQL statements. If you make an error, no harm will result, but it will not create any output for you to review. Contact Quadrant for help in creating your Quick Reports instead of beating your head against the wall trying to figure it out yourself. Seeing an example will help you understand how SQL works, and there is also lots of help with SQL statements available via the web, or via inexpensive guides to SQL server syntax. An excellent guide (available from Amazon) is "Sams Teach Yourself SQL in 10 Minutes" (10 minutes is a bit of an exaggeration, but it has simple and clear examples you can use to allow you to make quick progress on learning how to do basic SQL queries).

    Once the data is retrieved and displayed on your screen there is an option to export it to an Excel spreadsheet or to print it. You can sort the displayed data by clicking on the column titles.

    Here are a few comments about SQL and a sample query you may find helpful as an example:
    1. Suppose you want a list of all transactions for transaction code 1000 that appear in your transaction history between two dates. There are special keywords that can be used to specify the date range: @STARTDATE and @ENDDATE keywords will cause the program to prompt you for the starting and ending dates in the range of transactions you are looking for.

      The SQL statement would be similar to this:

      select rcpt_number, accounting_Date, tran_Code, user_id, cr_Account, extended_fee_amount
      from detail_view_deptcode_2020
      where accounting_Date between '@startdate' and '@enddate'
      and tran_code = '1000'
      and rcpt_status = 2


      The RCPT_STATUS = 2 part of the query tells the program to list only receipts that have not been voided. If you want to see those have been voided instead of those that have not change this to RCPT_STATUS = 99. If you want to see them all (voided and non-voided) you can just leave this portion of the query off, but in such a case it would be a good idea to add RCPT_STATUS to the list of fields to be displayed since it is the only way you will know the difference between them in the displayed data. So you query might look like this instead:

      select rcpt_number, accounting_Date, tran_Code, user_id, cr_Account, extended_fee_amount , rcpt_status
      from detail_view_deptcode_2020
      where accounting_Date between '@startdate' and '@enddate'
      and tran_code = '1000'
    2. SQL is an incredibly powerful tool for exploring your data. There are many features you can use to look at things in new ways. For example, suppose you wanted a quick list of your totals by TranCode by date. This query would do it for you:

      select tran_code, accounting_Date, sum(extended_fee_amount) as daily_total
      from detail_view_deptcode_2020
      where accounting_Date between '@startdate' and '@enddate'
      and rcpt_status = 2
      group by tran_code, accounting_date
    3. You can also use the SQL LIKE operator to find items that match a pattern or wildcard search. Suppose you wanted a quick list of transactions where the account number ended in 001. This query would return that information:

      select rcpt_number, accounting_Date, tran_Code, user_id, cr_Account, extended_fee_amount
      from detail_view_deptcode_2020
      where cr_account like '%001' and
      accounting_Date between '@startdate' and '@enddate'
      and tran_code = '1000'
      and rcpt_status = 2


      In this case the cr_account like '%-001' portion of the where tells the program to look for any account numbers that start with any string of characters and ends with -001. The % sign is the SQL wildcard character. You can used wildcards on any portion of a field, for example %-123-% would match any value that contained -123- anywhere within the value.

      You can also find receipts for a specific register number using the LIKE operator. The where clause : where rcpt_number like '001-%' would match receipts for register #001.

      RASWIN allows you to specify variable search criteria instead of hardcoded ones. For example you could look for TRAN_CODE = '1000' in your query or you could specify: TRAN_CODE = '@TRAN_CODE'. In the later case, the program will prompt you to enter the value you are looking for when you use the "Get Data" button. Your variable criteria can also use wild cards, but your comparison operator must then be LIKE instead of = , for exmaple:

      TRAN_CODE like '@TRAN_CODE'

      When you enter your data value in response to the request at run-time, your entry could be :12% which would match all codes starting with 12. Note that the like operator will function just as the = operator if there is a single matching value, e.g., LIKE '1234' would find only codes that are 1234, just as the = sign operator would; however, this is less slightly less efficient.
    4. As noted earlier SQL is very picky about spelling and punctuation, as well as having the correct field names. To our eyes, it may be perfectly understandable, but to SQL RCPTNUMBER is not the same as RCPT_NUMBER. A missing comma, or placing the portions of the SQL query in the wrong order will cause your query to fail. There needs to be a comma between the specified SELECT field names, but not after the last one, as shown in the samples above. The field names must be part of the view or table you are selecting from. The WHERE clause must come after the field names list. And GROUP BY values must come at the end of the query.
  5. The Quick Reports function is a QUERY ONLY function. It WILL NOT process statements that UPDATE or DELETE data from the database.
  6. The Quick Reports function can query the following tables. The tables listed below link to the specific columns that can be queried. The field names shown, if included in your query must be spelled exactly as shown in the file definition layouts.

    The variable name paramters are exactly the same, except they being with the @ sign.

    For example, if you want to list the TRAN_CODE from the trancodes table, the field name would be TRAN_CODE, and the variable parameter would be '@TRAN_CODE'.

    For dates and text values (shown as CHAR or VARCHAR datatypes in the table layouts) the parameter must be surrounded by single quote (') characters. Numeric values do not require the single quotes.