You are on page 1of 18

SQL BROWSER – Plugin

TurboCASH 4
With thanks to:
Pieter Valentijn (Delphidreams)
Philip Copeman
Selwyn Wacks
Sylvain Ntumba
Razak Accounting
The staff of Liandor Financial Accountants (Pty) Ltd

ISBN 0-620-30923-7
Author : DP Van Zyl
Date : 19 February 2009
© 2004-2009 Philip Copeman

This document contains proprietary information that is protected by copyright law. All rights are
reserved.

No part of this document may be reproduced, transmitted, transcribed, stored in a retrieval


system or translated into any language in any form or by any means, that is electronic,
mechanical, magnetic, optical, chemical, manual or otherwise, in whole or in part, without the
prior written consent of Philip Copeman.
Table of Contents
Introduction to the SQL Browser...........................................................................................5
License..............................................................................................................................5
Using the SQLBrowser.........................................................................................................6
SQL Browser Menu System...............................................................................................7
File Menu...................................................................................................................7
Options Menu.............................................................................................................7
Speedbar.......................................................................................................................7
Tables................................................................................................................................8
SQL Script Editor................................................................................................................8
Writing SQL Script ..........................................................................................................8
Font Editor.....................................................................................................................9
Records...........................................................................................................................10
Show / hide Columns.....................................................................................................11
Sequence of Data in Rows..............................................................................................12
Filter Options in Column Headings...................................................................................12
Custom Filter................................................................................................................13
Date Filter....................................................................................................................14
Export the Data ...............................................................................................................14
ANNEXURE A – TABLES IN A SET OF BOOKS.........................................................................15
Introduction to the SQL Browser

Introduction to the SQL Browser


If you are more than expert than the average user and you know how to write SQL (Structured
Query Language) then you will love the SQL Browser. Make any valid SQL query and run it.

The return or result of your SQL rows can be grouped, filtered and sorted with just a few
mouse clicks. This SQL browser also allows drag and drop features, which make it easy to work
with.

Anything can be exported to the XML (Extensible Mark-up Language), HTML (Hypertext Mark-
up Language), Microsoft Excel, or Text File formats. This powerful tool will empower you to
produce your own custom view of your data in TurboCASH4.

Even if you are not an expert in the details or file structure of TurboCASH4, you can also use
this SQL Browser to filter and sort to see what you need to see. You may also use the SQL
Browser to filter, sort and analyse your data.

This option allows you to generate queries and connect to the Database of a selected Set of
Books using the Structured Query Language (SQL) standard. This Browse will list all the
Firebird Database Files (*.fdb File extension) for the Set of Books. See the topic on the
Structure of TurboCASH4 for an overview of the file structure of TurboCASH4. You may also
read more on the Developers Guide to TurboCASH4.

This SQL Browser as a TurboCASH4 plug-in is developed by P Valentijn in the Netherlands and
more information may be obtained from the osFinancials Website in the Netherlands at
http://www.osfinancials.org.

License
This program is licensed under a commercial license. The following screen will be displayed
when this plugin is launched and will pop up with regular intervals:

This Plugin is already included in the TurboCASH4 release.


Commercial: Once-off payment
Order: http://www.osfshop.com/osfinancials-sqlbrowser-p-11.html

4 - TurboCASH4 – SQLBrowser Plugin


Using the SQLBrowser

Using the SQLBrowser


To use this option, you need to open a Set of Books. The SQL Browser will list all the tables in
the database of the active (opened) Set of Books.

To Access and Use the SQLBrowser:


1. Click on the Tools → Plug-ins → Tools → SQL Browser menu.

Alt + T + L + Q

The SQL Browser screen will be displayed. This will list all the tables of the active Set of
Books.
2. Select a table from the list. Right-click on the selected table and select he Open option
from the context menu. The data for the selected table will be loaded in the bottom half
of the TCASH Browser screen. In this documentation, the “TRANSACT” table is opened.
The transactions will be displayed as follows:

You may click on the + icon on the list to view the list of columns on the selected table
(e.g. TRANSACT as in this example).

A list of Tables is listed in Annexure A of this document.

3. You may use the context menu's on each of the sections to work with your data, if
necessary:

TurboCASH4 – SQLBrowser Plugin - 5


Using the SQLBrowser

a. Tables – Open, Drop or Empty a selected table. You may also extract data (i.e.
all Table names or the entire table including the properties (i.e. datatype and
width) in the wiki format to the Script Editor all the Table names in a Set of
Books. This can be copied and used in documentation and for development.
b. Script Editor – You may write or edit SQL script in this section. If the entire
table or a selected record is exported as SQL script in the Records section, it will
also be displayed in this section. You may also configure the editor font.
c. Records – This is the records in a table. For example, each line in a posted batch
will create a record in the TRANSACT (Transaction) table. In this section, you may
configure columns, filters, groups to view the data in a table. You may also
export the entire table or a selected record as SQL script to the SQL Editor.
4. Once you are done, you may Export, Save SQL and Load SQL.
5. To exit the SQL Browser, click on the File → Exit menu; or click on the Close button on
the titlebar.

SQL Browser Menu System

File Menu
The SQL Browser screen consists of the following sections:

Options Menu

Speedbar

6 - TurboCASH4 – SQLBrowser Plugin


Tables

Tables

TRANSACT.SREFERENCE

http://www.turbocash.net/wiki/index.php?title=TC4:SQL_Browser_-_Extract_modal_for_wiki

SQL Script Editor

Writing SQL Script


1. On the top half of the SQL Browser screen, the following SQL script is displayed:
Select * FROM followed by the name of the selected (active / opened) table. In this example,
Select * FROM TRANSACT represents the TRANSACT (Transaction) table.
2. After the name of the table, leave a space, type where and leave a space and type the
name of the column, (e.g. to list only those transactions for a specific date, type
DDATE).
3. Leave a space and type an Operator symbol (e.g. to list all transactions equal to the
value that needs to be entered, type = )
4. Leave a space and type a valid value (e.g. for the date, type '2009/03/16') This value
must start and end with an apostrophe.
5. Click on the Run icon (or press the Enter key on your keyboard) to run the script.
The following few examples based on the TRANSACT table.
Search / Filter by Examples
Date Select * FROM TRANSACT where DDATE='2009/03/16'
Reference Number Select * FROM TRANSACT where SREFERENCE='JNL1'
Document Number Select * FROM TRANSACT where SREFERENCE='IN000003'
Amount Select * FROM TRANSACT where FAMOUNT='1710'

TurboCASH4 – SQLBrowser Plugin - 7


SQL Script Editor

Font Editor
You may also customise the font in which the query data is to be displayed on the SQL Script
Editor.
To Edit the Font:
1. Right-click on the SQL Script Editor section of this screen and select the Editor Font …
option. Alternatively, click on the Options → Editor Font menu.

Alt + O + E

The Font screen is displayed:

2. Change the font, font style, size, effects and colour as necessary.
3. Click on the OK button. The text in the SQL Script Editor will be displayed in the
selected font.

8 - TurboCASH4 – SQLBrowser Plugin


Records

Records

The data for the selected table will be loaded in the bottom half of the TCASH Browser screen.
If you right-click on the records (table data) the following context menu is displayed:

The following buttons are available to navigate and edit or add new data records in
the SQL Browser:

- Go to the first record.

- Go to the previous record.

- Go to the next record.

- Go to the last record.

- Insert a new record (a blank line in which you may enter data).

- Delete a selected record.

- This button will activate the next two buttons (accept or reject).

- Accept any changes made to a selected record.

- Reject any changes made to a selected record.

- Refresh the records in the list.

TurboCASH4 – SQLBrowser Plugin - 9


Records

Date Select * FROM TRANSACT where DDATE='2009/03/16'


Columns – Configure (Show / hide) columns.
Filters – Apply filters.
Grouping – Apply grouping to the data.
Export as SQL insert – This will run and export the entire selected
table to SQL script.
Export record as SQL insert – This will run and export the selected
record to SQL script.

Show / hide Columns


The SQLBrowser displays all the columns for the selected table by default. You may filter (hide)
or show only those columns you need to see.
To configure columns:
1. The SQL Browser displays all the columns for the selected table by default. Should you
wish to hide any of these columns, you may click on the Options → Columns menu
option of the SQL Browser.

Alt + O + C

2. The Viewable Columns screen is displayed:

3. Select the following options, if necessary:


a. Show / Hide Columns – You may de-select (remove the tick) the columns
which you do not wish to view by simply removing the tick from the selected
column.

10 - TurboCASH4 – SQLBrowser Plugin


Show / hide Columns

You may click on the All button to select all columns.


To clear all remove all the columns, click on the Clear button. You may
then select place a tick only in those columns to be displayed in the
SQL Bowser.
To select (tick) or de-select (remove the tick), you may use the
Spacebar and use the Down and or Up keys to select a column.
b. Sequence – Should you wish to change the sequence in which the columns are
displayed, you may click on the or buttons.
4. Once your selection is finished click on the OK button to apply these changes to the
data in the SQL Browser.
Move Columns using the Mouse:
You may also click on a column and drag it to the right (or to the left) to change the
sequence in which you prefer the columns to be displayed.

Remove Columns using the Mouse:


If you wish to delete or remove a column, simply click on the column and drag it down
and leave the mouse button.

A list of Tables is listed in Annexure A of this document.


to Filter / Search for specific Values

Sequence of Data in Rows


All the data is by default displayed ascending; from the smallest to the highest value (e.g. a-z
or 0-9) according to the record number or record ID (e.g. Accounts.DB table it would be the
AccountID, in the TRANSACT table, it would be the TRANSACTIONID, etc.)
To change the sort order from ascending (e.g. a-z or 0-9) to descending (e.g. z-a or 9-0) select
a column and click on it. If you click on it again it will change back to ascending sequence.

Filter Options in Column Headings


While viewing and analysing the data you may sort and filter the data, in each column of the
active or loaded table. To do this, select the column and click on the drop-down arrow. A list
displaying the data as well as an All option and a customise option in the selected column will
be displayed.

For example, the Reference column (i.e. SREFERENCE) of the Transaction table (i.e.
TRANSACT) will display as follows:

TurboCASH4 – SQLBrowser Plugin - 11


Records

The filter for this column (as per example) will list all reference numbers as entered in batches
(journals) example, the reference for balancing entries (i,e, 8 asterisks ********) Reference
column (i.e. SReference) of the Transaction Database table (i.e. TransAct.DB).

Custom Filter
You have the following options to sort or filter the data:
 Select a specific entry from the list - only those entries which match the selection in the
table, will be listed, e.g. with the same reference number.
 All - Select to display all the entries in the selected table.
 Custom - This will launch a screen on which you may set further criteria to filter the
data.

.
a. Equal to - list or display all values which is the same as the specified value.
b. Not equal to - list or display all values which is not the same as the specified
value.
c. Less than - list or display all values smaller than the specified value.
d. Less than or equal to - list or display all values smaller or equal to the specified
value.

12 - TurboCASH4 – SQLBrowser Plugin


Custom Filter

e. Greater than - list or display all values greater than the specified value.
f. Greater than or equal to - list or display all values greater or equal to the
specified value.
g. Like - list all values in the table similar to the specified value.
h. Not like - list all values in the table not similar to the specified value.
i. Is null - excludes any value entered, will not be listed or displayed.
j. Is not null - is not zero - any value which is not equal to zero will be listed or
displayed.

Date Filter
If you are working in a column of which the data is dates, the following date selector screen will
be displayed:

You may then select a specific date to search or filter the data in the table.

Export the Data


Once you have sorted and filtered your criteria, you may:
• Export the data in exactly the same sequence as displayed in the bottom half of the
SQLBrowser screen to any of the following file formats:
a. XML - Extensible Mark-up Language
b. HTML - HyperText Mark-up Language
c. Excel - Microsoft Excel Spreadsheet
d. Text - Text file
• Save the SQL in a (*.slq) SQL File format. You may then at any later stage open the
saved *.slq file in the Tcash Browser.

TurboCASH4 – SQLBrowser Plugin - 13


ANNEXURE A – TABLES IN A SET OF BOOKS

ANNEXURE A – TABLES IN A SET OF BOOKS


ABREVIAT

ACCOUNT

ACCOUNTREF

ADDRESSPERACCOUNT

ASSETMAS

BACKORD

BANK

BAT0T1

BAT0T2

BAT0T23

BAT0T3

BAT0T4

BATCON

BATRBT0T4

BATTYPES

BOM

CONTACTS

COUNTRIES

CREDITOR

CURRENCY

DEBTOR

DNLBANKS

DOCBATCH_0_0

DOCHEAD

DOCLINE

14 - TurboCASH4 – SQLBrowser Plugin


ANNEXURE A – TABLES IN A SET OF BOOKS

EMPMAS

EMPSOURCE

EVENTS

EVENTSPECIALDAYS

FLOWTMP

GLOBAL

GROUPS

GROUPSSTATUS

IMP_LINK

IMP_SOURCE

IMP_STOCKACCOUNTS

IMP_TOTALS

JOBPROJECT

KEYSCONT

LABSPECS

LOCATIONS

LOGENTRY

LOGGEDIN

MANUFACD

MANUFACH

MESSAGES

MULTIMEDIA

MULTIMEDIABLOB

OILINKS

OPREPORT

TurboCASH4 – SQLBrowser Plugin - 15


ANNEXURE A – TABLES IN A SET OF BOOKS

OSF_EDIT_FIELDS

OSF_EDIT_FORM

OSF_SEARCH_FIELDS

PAYCON

PAYTRANS

PERIODS

POSTBATCH_0_0

PRINTERS

PROFILES

RDB$CHARACTER_SETS

RDB$CHECK_CONSTRAINTS

RDB$COLLATIONS

RDB$DATABASE

RDB$DEPENDENCIES

RDB$EXCEPTIONS

RDB$FIELDS

RDB$FIELD_DIMENSIONS

RDB$FILES

RDB$FILTERS

RDB$FORMATS

RDB$FUNCTIONS

RDB$FUNCTION_ARGUMENTS

RDB$GENERATORS

RDB$INDEX_SEGMENTS

RDB$INDICES

16 - TurboCASH4 – SQLBrowser Plugin


ANNEXURE A – TABLES IN A SET OF BOOKS

RDB$LOG_FILES

RDB$PAGES

RDB$PROCEDURES

RDB$PROCEDURE_PARAMETERS

RDB$REF_CONSTRAINTS

RDB$RELATIONS

RDB$RELATION_CONSTRAINTS

RDB$RELATION_FIELDS

RDB$ROLES

RDB$SECURITY_CLASSES

RDB$TRANSACTIONS

RDB$TRIGGERS

RDB$TRIGGER_MESSAGES

RDB$TYPES

RDB$USER_PRIVILEGES

RDB$VIEW_RELATIONS

RECON0

RECONBANK

REPCELLS

REPCOLS

REPHEAD

REPLINE

REPORTOP

REPTBAT

REPTDOCS

TurboCASH4 – SQLBrowser Plugin - 17


ANNEXURE A – TABLES IN A SET OF BOOKS

RESOURCES

STOCK

STOCKPUB

STOCKTRN

SYSPARAMS

SYSVARS

SYSVARSEXT

TASKACTION

TASKS

TAX

TEMP1

TMPAGEAN

TOTALS

TRANSACT

TRANSACTASBATCH

TYPES

UNIT

USERS

V_OPENDOCAMOUNT

V_TRANSACTASBATCHWITHTRANSID

V_TRANSACTTAXENTRIES

YEARS

18 - TurboCASH4 – SQLBrowser Plugin

You might also like