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

From Lianjapedia
Jump to: navigation, search
(Lianja Web Client built-in Lianja/VFP functions)
(Lianja Web Client built-in Lianja/VFP functions)
Line 151: Line 151:
 
|valign="top"|tostring()||valign="top"|arg as expression||valign="top"|Returns the given arg as a string type.
 
|valign="top"|tostring()||valign="top"|arg as expression||valign="top"|Returns the given arg as a string type.
 
|-
 
|-
|valign="top"|username()||valign="top"|none||valign="top"|Retturns name of the logged in user.
+
|valign="top"|username()||valign="top"|none||valign="top"|Returns the name of the logged in user.
 
|-
 
|-
 
|valign="top"|upper()||valign="top"|arg as string||valign="top"|Convert to upper case.
 
|valign="top"|upper()||valign="top"|arg as string||valign="top"|Convert to upper case.

Revision as of 22:34, 24 February 2019

Lianja Web Client built-in Lianja/VFP functions

The following Lianja/VFP functions are included in the Lianja HTML5 Client API for JavaScript.

Bm-noteicon.png
Pro Tip

As of Lianja 5, you can use console.log(text) to help debug your code in desktop, web and mobile Apps. Previously this was not available in desktop Apps.
Additionally, if you place the keyword debugger in your JavaScript code the JavaScript debugger will be activated.

Function Arguments Description
addslashes() arg as string Quote string with slashes.
alltrim() arg as string Remove leading and trailing spaces.
at() substring as string,
source as string
[, start as numeric]
Search for substring and return position.
base64_decode() text as string Function to decode a text string from MIME base64.
base64_encode() text as string Function to encode a text string to MIME base64.
between() value as expression,
low as expression,
high as expression
Function to check that a given value is within a given range.
cdow() source as date Function to return the day of the week from the specified date as a string.
choose() index as numeric,
value as expr
[, ...]
Returns the nth argument in the argument list. The first index is 1. If index is out of bounds returns an empty string.
chrtran() source as string,
find as string,
replacewith as string
Function to replace text within a string.
cmonth() source as date Function to return the month from the specified date as a string.
createObject() class as string Create new object based on the specified UI class.
ctod() source as string Function to return the specified string as a date.
date() [year as numeric,
month as numeric,
day as numeric]
Function to return system or the specified date as a date.
day() source as date Function to return the day of the month from the specified date as a numeric.
dow() source as date Function to return the day of the week from the specified date as a numeric.
dtoc() source as date Function to return the specified date as a string.
dtos() source as date Function to return the specified date as a string in the format YYYYMMDD.
empty() arg as expression Returns true if the given expression is empty, i.e. an empty string, a numeric zero or a boolean false.
endsWith() source as string,
substring as string
Check if source string ends with substring.
etos() source as expr
[, length as numeric]
Evaluate expression and return it as a string, optionally specifying length.
explode() separator as expression,
string as expression
Returns an array by splitting the given string up as specified by the given separator.
function_exists() arg as string Returns true if the specified function is declared.
guid() none Returns a GUID.
icase() condition as logical,
result as expr
[, ...]
[, otherwiseresult]
Execute immediate case statement. Evaluates a condition then if it is true returns the next argument in the argument list. If no conditions are true returns the otherwiseresult.
iif() condition as logical,
expression1 as exp,
expression2 as exp
Execute an immediate if. Returns expression1 if condition is true otherwise returns expression2.
implode() separator as expression,
array as expression
Returns a string of all items in the given array separated by the given separator.
in_array() value as expression,
array as expression
Returns true if the given value is in the specified array.
indexOf() source as string,
substring as string
Search for substring and return position.
inlist() source as string,
list as string
Check if source string is contained in a list of arguments.
inputBox() prompt as string
[, title as string
[, defaultvalue as string
[, okcallback as function
[, cancelcallback as function]]]]
Display a dialog inputbox and continues execution. If the callback functions are specified they are called with the value input as an argument on clicking a button.
is_array() arg as expression Returns true if the given arg is an array.
is_date() arg as expression Returns true if the given arg is a date.
is_float() arg as expression Returns true if the given arg is a number.
is_function() arg as expression Returns true if the given arg is a function.
is_int() arg as expression Returns true if the given arg is a number.
is_logical() arg as expression Returns true if the given arg is a boolean.
is_numeric() arg as expression Returns true if the given arg is a number.
is_object() arg as expression Returns true if the given arg is an object.
is_string() arg as expression Returns true if the given arg is a string.
len() source as expr
[, options as logical]
Return length of expression.
loadlibrary() fileURL.js as string Load the specified JavaScript file.
lower() arg as string Convert to lower case.
lpad() source as string,
length as numeric
[, padchar as string]
Pad string to defined length from left.
ltrim() source as string Remove leading spaces.
md5() source as string MD5 encypts the specified string.
messageBox() message as string
[, options as numeric
[, title as string
[, okcallback as function
[, cancelcallback as function]]]]
Display a dialog box and continues execution. If the callback functions are specified they are called on clicking a button.
month() source as date Function to return the month from the specified date as a numeric.
padl() source as string,
length as numeric
[, padchar as string]
Pad string to defined length from left.
padr() source as string,
length as numeric
[, padchar as string]
Pad string to defined length from right.
proper() source as string Convert to proper case.
reccount() alias as string Return record count.
recno() alias as string Return current record number.
replicate() arg as expression,
count as expression
Returns a string which is a replication of the given arg 'count' times.
require() jsfileURL as string Load the specified JavaScript file.
require_once() jsfileURL as string Load the specified JavaScript file (if not already loaded).
rowcount() alias as string Return row count (excludes deleted and those not matching current filter).
rpad() source as string,
length as numeric
[, padchar as string]
Pad string to defined length from right.
rtrim() source as string Remove trailing spaces.
space() len as numeric Returns a string of len spaces.
startsWith() source as string,
substring as string
Check if source string starts with substring.
str() source as numeric
[, width as numeric
[, decimals as numeric]]
Convert numeric to string.
strlen() source as expr
[, options as logical]
Return length of expression.
strtran() source as string,
find as string,
replacewith as string
Function to replace text within a string.
str_replace() substring as string,
replacestring as string,
source as string
Search for substring and replace with replacestring in source.
substr() source as string,
start as numeric
[, end as numeric]
Extract substring.
time() none Function to return current system time.
tostring() arg as expression Returns the given arg as a string type.
tostring() arg as expression Returns the given arg as a string type.
username() none Returns the name of the logged in user.
upper() arg as string Convert to upper case.
val() arg as string Convert string to numeric.
year() arg as date Function to return the year from the specified date as a numeric.