Script functions

Functions enable actions in scripts that cannot be performed using SQL.
Some functions return a value that can be stored in a variable or used directly.

Table of Contents

contextGetValue()

Get value of a UI object.

var1=contextGetValue(objectName,property); -- For buttons
var2=contextGetValue(tableName,fieldName); -- For grids
var3=contextGetValue
(objectName); -- For other objects

objectName is shown in tooltip in modification mode.

property : 'enabled' (or empty) / 'visible' / 'checked'

contextSetValue()

Set value for a UI object.

contextSetValue(objectName,value,property); -- For buttons
contextSetValue(tableName,value,fieldName); -- For grids
contextSetValue(objectName,value); -- For other objects

objectName is shown in tooltip in modification mode.

property : 'enabled' (or empty) / 'visible' / 'checked'

format()

var1='Date is '||format(Date);

returned value : local display format.

Date : SQLite date format. Ex: '2026-01-01'. 

getFileContent()

Get file content from a local file or URL.

blobVar1=getFileContent(filePath);

getVarValue()

Retreive var value from var literal name.

var1='coucou';
var2=getVarValue('var1');

iif()

var1=iif(Condition,valIfTrue,ValIfFalse);

parseFile()

parseFile(FilePath or URLPath,format,varNamePrefix[,key1[,key2[...]]]);

format : json (only supported format at this time).

varNamePrefix : prefix for variable name where to store the file data.
If empty, 'json' is used.

keyN : key to retreive in file. Il empty, all key are stored in variables.

The data in the file is stored in variables named as follows:
varNamePrefix + "_" + json level 1 key + "_" + json level 2 key ...

If key is an array, variables named are :
varNamePrefix + "_" + json level 1 key + "_" + counter + "_" + json level 2 array key ...

First json level is ignored for var names if varNamePrefix ends with '*'. Usefull if 1rst level key is unknown or not constant.

parseFile('https://openlibrary.org/api/...','OL','json*');
json

After parsing, variables are :

OL_url
OL_key
OL_title
OL_subtitle
OL_authors_000_url
OL_authors_000_name
OL_authors_001_url
OL_authors_001_name

refreshLaunchers()

Refresh the main menu and application buttons.

refreshLaunchers();

tr()

tr(textToTranslate[,arg1[,arg2...]]);

returned value : translated phrase in language selected by user.

textToTranslate : constant text containing '%<n>' anchors for arguments location.

arg<n> : not constant value.

In modification mode, this function create the translation keys (textToTranslate) in the translation tables.

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.