Difference between revisions of "Python built-in Lianja/VFP functions"
From Lianjapedia
Yvonne.milne (Talk | contribs) (→See Also) |
Yvonne.milne (Talk | contribs) (→Desktop Only Functions) |
||
Line 133: | Line 133: | ||
!width="60%"|Description | !width="60%"|Description | ||
|- | |- | ||
− | |valign="top"|bindEvent()||valign="top"| | + | |valign="top"|bindEvent()||valign="top"|obj as object,<br>eventname as string,<br>delegate as string||valign="top"|Binds a delegate to an event for an object. |
|- | |- | ||
|valign="top"|clear_events()||valign="top"|none||valign="top"|Stops event processing started with read_events(). | |valign="top"|clear_events()||valign="top"|none||valign="top"|Stops event processing started with read_events(). |
Revision as of 12:37, 5 March 2024
Under construction
Overview
See Also
JavaScript built-in LianjaScript functions, Lianja/KVS (Key-Value Store), OData URIs, Python Server Pages, Working with JSON and JQL, 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() | filename as string | Reads the specified filename and returns its contents as text. |
getparameter() | parameter as string, default as string |
Returns the value of a parameter passed to a .pysp script or returns the default value if the parameter was not passed. |
getParameter() | parameter as string, default as string |
Returns the value of a parameter passed to a .pysp script or returns the default value if the parameter was not passed. |
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() | sourcefile as string, targetfile as string |
Moves and uploaded sourcefile to the location specified in targetfile. |
odata_Create() | uri as string, jsondatastring as string |
Creates a record. |
odata_Delete() | uri as string, jsondatastring as string |
Deletes one or more records. |
odata_Read() | uri as string [, filename as string] |
Reads one or more records, optionally saving the returned JSON data to the specified filename. |
odata_Update() | uri as string, jsondatastring as string |
Updates one or more records. |
openDatabase() | database as string | Opens the specified Lianja database. |
strtofile() | text as string, filename as string [, append as int] |
Writes the specified text out to the specified filename and returns the number of bytes written as a numeric. If append is omitted or < 1, the contents of filename are overwritten; > 0 the text is appended to the contents. |
unlink() | filename as string | Deletes the specified filename. |
Desktop Only Functions
The following LianjaScript functions are built into Lianja Python for desktop Apps only.
Function | Arguments | Description |
---|---|---|
bindEvent() | obj as object, eventname as string, delegate as string |
Binds a delegate to an event for an object. |
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. |