Difference between revisions of "Python built-in Lianja/VFP functions"

From Lianjapedia
Jump to: navigation, search
(See Also)
(See Also)
Line 4: Line 4:
  
 
==See Also==
 
==See Also==
[[Key-Value Store|Lianja/KVS (Key-Value Store)]], [[:Category:OData_Functions|Working with OData]]
+
[[JavaScript built-in Lianja/VFP functions|JavaScript built-in LianjaScript functions]], [[Key-Value Store|Lianja/KVS (Key-Value Store)]], [[:Category:OData_Functions|Working with OData]]
  
 
==Functions==
 
==Functions==

Revision as of 11:42, 5 March 2024

Under construction

Overview

See Also

JavaScript built-in LianjaScript functions, Lianja/KVS (Key-Value Store), Working with OData

Functions

The following LianjaScript functions are built into Lianja Python.

The function names are case-sensitive - in some cases more than one format is supported.

Function Arguments Description
createObject() [objectname as string,]
classname as string
Creates a Lianja object.
die() message as string Closes all open files and ends the Lianja process and returns the specified message to the operating system or calling script.
echo() expression as string | expression as numeric Evaluates the expression and displays the results on the same line. A string expression can include 'C' style escapes: \t (tab), \n (new line), \r (carriage return).
filetostr()
getparameter()
getParameter()
kvs_add() kvsid as numeric,
key as string | key as numeric,
value as objectname | value as arrayname | value as expression
Add key/value for the specified key. If the value is an object or array it is automatically JSON encoded.
To load the contents of a text file, you can use the filetostr() function which is built-in in Lianja/Python.
kvs_add(k, key, filetostr("filename.txt") )
kvs_clear() kvsid as numeric Remove all key/value pairs from the store.
kvs_close() kvsid as numeric Close the KVS.
kvs_contains() kvsid as numeric,
key as string | key as numeric
Returns true if key contained in the store.
kvs_count() kvsid as numeric Returns count of number of key/value pairs in the store.
kvs_create() kvsfilename as string,
keylen as numeric
[, enablelogging as logical]
Create a new KVS with keys of keylen length. Returns a numeric kvsid.
kvs_generate() kvsid as numeric,
count as numeric
Generate count new key/value pairs.
kvs_get() kvsid as numeric,
key as string | key as numeric
[, default as string
[, membername as string]]
Fetch value for the specified key. If the value is an object then membername specifies a member (property) to return.
kvs_getall() kvsid as numeric
[, key as string | keyPattern as string]
Fetch all keys/values for the specified key. keyPattern may end in * to match wildcard keys. Returns a dynarray of arrays.
kvs_getAll() kvsid as numeric
[, key as string | keyPattern as string]
Fetch all keys/values for the specified key. keyPattern may end in * to match wildcard keys. Returns a dynarray of arrays.
kvs_getrange() kvsid as numeric,
offset as numeric,
count as numeric
Fetch a range of key/value pairs (offset starts at 1). Returns an array of two elements, key and value.
kvs_getRange() kvsid as numeric,
offset as numeric,
count as numeric
Fetch a range of key/value pairs (offset starts at 1). Returns an array of two elements, key and value.
kvs_info() kvsid as numeric Displays information about the specified KVS file.
kvs_isvalid() kvsid as numeric Check validity of the given ksvid.
kvs_keys() kvsid as numeric
[, key as string | keyPattern as string]
Fetch all keys for the specified key. keyPattern may end in * to match wildcard keys.
kvs_list() kvsid as numeric List the key/values in the store to the console (useful during development for debugging).
kvs_listlog() kvsid as numeric List binary transaction log associated with the store to the console (useful during development for debugging).
kvs_listLog() kvsid as numeric List binary transaction log associated with the store to the console (useful during development for debugging).
kvs_loadfromfile() kvsid as numeric,
filename as string
Load key/value pairs from the specified file.
kvs_loadFromFile() kvsid as numeric,
filename as string
Load key/value pairs from the specified file.
kvs_max() kvsid as numeric Returns max key.
kvs_min() kvsid as numeric Returns min key.
kvs_next() kvsid as numeric Position on next key/value pair returns an array of two elements: key and value.
kvs_open() kvsfilename as string
[, shared as logical]
Open an existing KVS. shared allows the KVS to be opened shared/exclusive.
kvs_rebuild() filename as string Rebuild the KVS file from the binary transaction log.
kvs_remove() kvsid as numeric,
key as string | key as numeric
Remove the specified key.
kvs_removefirst() kvsid as numeric Use for queue. Returns an array of two elements: key and value.
kvs_removeFirst() kvsid as numeric Use for queue. Returns an array of two elements: key and value.
kvs_removelast() kvsid as numeric Use for stack. Returns an array of two elements: key and value.
kvs_removeLast() kvsid as numeric Use for stack. Returns an array of two elements: key and value.
kvs_removerange() kvsid as numeric,
offset as numeric,
count as numeric
Fetch a range of key/value pairs (offset starts at 1).
kvs_removeRange() kvsid as numeric,
offset as numeric,
count as numeric
Fetch a range of key/value pairs (offset starts at 1).
kvs_rewind() kvsid as numeric Position on first key/value pair. Returns an array of two elements: key and value.
kvs_savetofile() kvsid as numeric,
txtfilename as string
[, upgrade as logical]
Save key/value pairs to the specified file.
kvs_saveToFile() kvsid as numeric,
txtfilename as string
[, upgrade as logical]
Save key/value pairs to the specified file.
kvs_set() kvsid as numeric,
key as string | key as numeric,
value as objectname | value as arrayname | value as expression
Add/update key/value for the specified key. If the value is an object or array, it is automatically JSON encoded.
kvs_update() kvsid as numeric,
key as string | key as numeric,
value as objectname | value as arrayname | value as expression
Update value for the specified key. If the value is an object or array, it is automatically JSON encoded.
kvs_values() kvsid as numeric
[, key as string | keyPattern as string]
Fetch all values for the specified key. keyPattern may end in * to match wildcard keys.
move_uploaded_file()
odata_Create()
odata_Delete()
odata_Read()
odata_Update()
openDatabase()
strtofile()
unlink()

Desktop Only Functions

The following LianjaScript functions are built into Lianja Python for desktop Apps only.

Function Arguments Description
bindEvent() tbc tbc.
clear_events() none Stops event processing started with read_events().
debug() text as string Writes the specified text to the debug file (set debug on).
debugout() text as string Writes the specified text to the Troubleshooter Debugout Tab.
inputBox() [prompt as string] Display a box prompting for input. The prompt can optionally be specified; the default prompt is 'Enter value:'
messageBox() message as string
[, options as numeric
[, title as string]]
Display a message in a box with an optional title.
See MESSAGEBOX() for the numeric options to customize the buttons and icon and for the return values.
read_events() none Suspends execution until a clear_events() is executed.