Custom SQL Script

From CaseTalk Wiki
Jump to: navigation, search

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.