Scripts
Source files : scripts/ScriptName.sqlf
Table of Contents
SQL queries
BEGIN TRANSACTION;
COMMIT; -- Save changes made since BEGIN TRANSACTION to disk.
ROLLBACK; -- Discard changes made since BEGIN TRANSACTION.
INSERT INTO myTable ...; -- Number of row inserted is stored in variable insert_myTable.
UPDATE myTable ...; -- Number of row updated is stored in variable update_myTable.
DELETE FROM myTable ...; -- Number of row deleted is stored in variable delete_myTable.
-- In calculated expr :
'Coucou='||(SELECT Field1 FROM myTable WHERE ...)
1+(SELECT count() FROM myTable WHERE ...)
An automatic BEGIN TRANSACTION is fired at start of the script and a ROLLBACK is fired if an error occurs.
Variables
Variable names are made of 'abcdefghijklmnopqrstuvwxyz_1234567890'.
Affectation
var1=1;
var1='coucou';
var1=1+1; -- 2 is stored.
var1='cou'||'cou'; -- 'coucou' is stored.
var1=(SELECT * FROM myTable); -- Row 0 col 0 value is stored.
var1=(SELECT * FROM myTable WHERE false); -- 0 is stored if no row returned by SELECT.
Usage
var2=var1+1;
if (var2==var1) {...}
UPDATE myTable SET Field1=var2;
C-like
if (1==2) {
-- Never
} else if (1==3) {
-- Never
} else {
-- Always
}
var1=0;
while (var1<10) {
...
var1=var1+1;
}
return; -- Interrupting and exiting the script.
User dailogs
Input dialog
var1=inputDialog(text,
inputLabel,inputType,inputGeometry,valDef
[,dialogType[,dialogGeometry[,buttonSet]]]);
returned value : value of the input widget.
Inputs dialog
inputsDialog(text,
varName,inputLabel,inputType,inputGeometry,
valDef,constraint,constraintErrMess,toolTip
[,varName,inputLabel,inputType,inputGeometry,
valDef,constraint,constraintErrMess,toolTip]
...
[,dialogType[,dialogGeometry[,buttonSet]]]]);
varName : variable where to store the input.
toolTip : help text displayed on input widget mouse over.
Input parameters
inputLabel : at the left of the input widget. Unused for checkbox.
inputType :
- it_Bool : CheckBox
- it_Date, it_Integer, it_Real : EditBox
- it_Text : EditBox or TextBox (height>0) or ComboBox (more than 1 possible values).
- it_Dir : selecting a directory.
- it_DirNew : Input of a non-existent directory.
- it_DirExists : selecting an existing directory.
- it_File : selecting a file.
- it_FileOpen : selecting an existing file.
- it_FileSave : selecting a file path with warning if file exists.
- it_Table : selecting a new value or value from a table.
- it_TableExists : selecting a value existing in a table.
- it_TableNew : selecting a value non-existent in a table.
- it_TableCombo : selecting a value via ComboBox from a table containing fewer than 20 records.
- it_Title : no input, simple bold title.
inputGeometry : label left, label width, input width, input height, '|' separed. Default values are :
- it_Bool : '0|0|350|-1'.
- it_Date : '0|250|120|-1'.
- it_Integer, it_Real : '0|250|80|-1'.
- it_FileXXX, it_DirXXX, : '0|250|300|-1'.
- it_TableXXX : '0|250|150|-1'.
- it_Title : '0|250|0|-1'.
- it_Text (EditBox) : '0|250|200|-1'.
- it_Text (ComboBox) : '0|250|150|-1'.
If it_Text and input height > 0, default width is 400.
valDef
- it_Bool : true or false.
- it_Date : default, min and max values, '|' separed (ex '2026-01-01|2026-01-01|2026-12-31').
- it_Integer, it_Real : default, min and max values, '|' separed (ex '1|0|100').
- it_Text : default and possibles values, '|' separed (ex 'Cat|Cat|Dog'). First parameter is default value. If more than 2 parameters, input widget is ComboBox. If last parameter is "*", user can enter new value (ex 'Cat|Cat|Dog|*').
- it_TableXXX : default value, table name, field name, where close, '|' separed (ex 'Marc|MyTable|First_name|First_name LIKE 'M%''). With it_TableCombo, if 5th parameter is "*", user can enter new value (ex 'Marc|MyTable|First_name||*')
Message dialog
messageDialog(shortText[,longText[,dialogType[,dialogGeometry]]]);
Ok cancel dialog
var1=okCancelDialog(text[,dialogType[,dialogGeometry[,buttonSet]]]);
returned value : 1 if clicked button is Ok, Next or Finish. 0 otherwise.
Radio buttons dialog
var1=radioButtonDialog(text,options[,defOptionIndex[,disabledOptionIndexes,
[,dialogType[,dialogGeometry[,buttonSet]]]]]);
returned value : index of checked radio button if clicked button is Ok, Next or Finish. Null otherwise.
options : Labels for radio buttons, '|' separed. Ex: 'Option 1|Option 2'.
defOptionIndex : default radio button index, from 0.
disabledOptionIndexes : indexes of visible but disabled radio buttons, '|' separed. Ex: '0|2'.
Select dialog
selectDialog(text,varName,selectStatement[,toolTip[,dialogType[,buttonSet]]]);
varName : prefix for variable names where to store the selected row field values. Field1 value is stored in varName+'_Field1'. All field values of selected row are stored.
Selected column field name is stored in varName+'_selectedColName'.
Selected column field value is stored in varName+'_selectedColValue'.
selectStatement : SELECT SQL query.
Table dialog
tableDialog(text,varName,tableName[,whereClose[,toolTip[,dialogType[,buttonSet]]]]);
varName : prefix for variable names where to store the selected row field values. Field1 value is stored in varName+'_Field1'. All field values of selected row are stored.
Selected column field name is stored in varName+'_selectedColName'.
Selected column field value is stored in varName+'_selectedColValue'.
tableName : Table or view name.
whereClose : Without WHERE keyword. Ex: 'Field1 NOTNULL'
Yes no dialog
var1=yesNoDialog(text[,dialogType[,dialogGeometry]]);
returned value : 1 if clicked button is Yes. 0 otherwise.
Dialog parameters
When exiting the dialogs, clicked button is stored in exitButtonDialog variable as eb_Previous, eb_Ok or eb_Cancel.
Ok, Next and Finish buttons give eb_Ok.
dialogGeometry : width, height, left and top, '|' separed (ex '400|200|100|100'). If left and top are missing, windows is centered.
dialogType (standard pixmap) : sp_Critical, sp_Information, sp_None, sp_Question, sp_Warning.
Functions
format()
var1='Date is '||format(Date);
returned value : local display format.
Date : SQLite date format. Ex: '2026-01-01'.
iif()
var1=iif(Condition,valIfTrue,ValIfFalse);
refreshLaunchers()
Refresh the main menu and application buttons.
refreshLaunchers();tr()
tr('Bonjour') -- 'Hello' if you set this translation for 'en'.
returned value : translated phrase in language selected by user.
system functions
var1=sysCmd(cmd[,wait]);
var1=sysOpen(fileName[,wait]);
var1=sysRun(program[,args[,wait]]);
returned value : cmd exit code.
If function fails, system error is stored in sysLastError variable and the script execution continue.
wait : if true, FADAcore is frozen and wait for end of the system command.