Difference between revisions of "Custom SQL Script"
From CaseTalk Wiki
(Created page with "= Custom Script = The custom script is a sql script in which the database may be extended and/or data transformed. CaseTalk itself does not use any additional tables or views...") |
m (→Custom Script) |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
This script is fired after every sql transaction that CaseTalk applies to the repository. | This script is fired after every sql transaction that CaseTalk applies to the repository. | ||
-- | |||
DROP VIEW IF EXISTS $SCHEMA$.MyLabelTypes; | |||
-- | |||
CREATE VIEW $SCHEMA$.MyLabelTypes AS | |||
SELECT OTFTNAME as LabelType | |||
FROM $SCHEMA$.OTFT | |||
WHERE TYPE='L' | |||
The previous script is simply provided to illustrate a sqlite script which can be used to extract all label types into a distinct view, and will be exported in CSV, XLS, etc, along with all the other tables in which the model is stored. | |||
Naturally this can be joined with information from the custom attributes table. | |||
Remember to test the sql in the [[Modeler:8/RepositorySql| sql repository window]]. |
Latest revision as of 15:50, 6 February 2018
Custom Script
The custom script is a sql script in which the database may be extended and/or data transformed. CaseTalk itself does not use any additional tables or views which may be created, yet does export them as part of the model repository tables.
This script is fired after every sql transaction that CaseTalk applies to the repository.
-- DROP VIEW IF EXISTS $SCHEMA$.MyLabelTypes; -- CREATE VIEW $SCHEMA$.MyLabelTypes AS SELECT OTFTNAME as LabelType FROM $SCHEMA$.OTFT WHERE TYPE='L'
The previous script is simply provided to illustrate a sqlite script which can be used to extract all label types into a distinct view, and will be exported in CSV, XLS, etc, along with all the other tables in which the model is stored.
Naturally this can be joined with information from the custom attributes table.
Remember to test the sql in the sql repository window.