-
Notifications
You must be signed in to change notification settings - Fork 43
Using TeeBI
The low-level classes and features explained above, are used in "high-level" mode by several design-time components, user interface dialogs, and the "BIWeb" server.
This allows non-code working with all TeeBI features, inside the ide at design-time, or at runtime in your own applications, or using the BIWeb server configuration dialogs.
A "Store" represents a location, a place, where you have data that has been already persisted to disk files using the BI.Persist
unit classes.
Data can be saved to disk as in the first example of this document (creating the data by hand and then saving it to a disk file), or it can also be imported automatically from several sources and formats, and saved to disk.
To enable all user interfaces and design-time components to locate data (in high-level mode), its necessary to previously configure a machine with at least a defined "Store".
Under Windows, this is simply a registry entry that is automatically generated using the "Store Manager" editor dialog:
Here we have several stores, with the "local" store selected as "Default".
A "store" can point to a disk folder in the same machine or network, or it can point to a www web address.
When using a web address, the Store expects a BIWeb server running at that site.
A store can also be defined to point to a web "localhost" server (a BIWeb running on the same machine).
Stores information are saved to Windows registry key:
HKEY_CURRENT_USER\SOFTWARE\Steema Software\TeeBI\Store
Or to a simple *.ini file for other systems (Mac OSX, iOS, Android).
The BI.Persist
unit includes classes to manage stores by code (TStore
and TStores
classes). The TStore
class can also be used to obtain (load) data from a Store into memory:
var D : TDataItem;
D:= TStore.Load( 'SQLite_demo' ); // <-- from the "default" store
or:
D:= TStore.Load( 'Hong Kong', 'SQLite_demo' ); // <-- from a specific "Hong Kong" store
When using a TStore
to load data, it will automatically try first to locate the data in the global memory cache.
If it's not there yet, it will appropriately load it from a disk file or from a web http server, transparently.
Data loaded via TStore
does not need to be released explicitly (D.Free
or D.DisposeOf
), as it will be destroyed when the application finishes or the memory cache needs more memory.
The Data Manager dialog allows adding data to a Store.
Each data has a name that corresponds to the string parameter of TStore.Load
method.
A BIDataSet
is like a normal TDataSet
component, with a "Data" property that can be assigned at design-time or runtime:
BIDataSet1.Data := Orders;
BIDataSet1.Open;
When setting Data at design-time, the "origin" Store of the data (a disk file or web server address) will be persisted together with the dataset into the *.dfm or *.fmx form, for later reload.
BIDataSet
has also a public "Cursor" property of type TDataCursor
, enabling sorting and filtering, and a "Summary" property of type TSummary
to provide query capabilities.
When linking a BIDataSet
to a BIGrid
or BIChart
(through a standard TDataSource
component), the grid and chart will detect and make use of the BIDataSet
cursor features, for example to sort grid columns clicking them at the headers.
BIDataSet
can then be used as a normal (read-only by default) DataSet:
DataSource1.Dataset := BIDataSet1;
DBGrid1.DataSource := DataSource1;