Object. For each JavaScript context there is a pre-created Lasso object named "lasso". Lasso objects can neither be created nor destroyed.
The lasso object provides access to global and constant information such as version numbers, the current platform name and predefined search operators.
The lasso object has the following properties:
|
Property |
Description |
|---|---|
| commonCodeVersion | The version number of the LassoCommonCode DLL. |
| editionVersion | The version number of the Lasso application, plugin or runtime engine. |
| platformName | The name of the platform Lasso is currently running on. |
| defaultSession | The default LassoSession object for the JavaScript context. |
| opGreaterThan | A read-only property used to indicate a "greater than" comparison. |
| opGreaterThanEquals | A read-only property used to indicate a "greater than or equal to" comparison. |
| opEquals | A read-only property used to indicate an "equal to" comparison. |
| opLessThan | A read-only property used to indicate a "less than" comparison. |
| opLessThanEquals | A read-only property used to indicate a "less than or equal to" comparison. |
| opBeginsWith | A read-only property used to indicate a "begins with" comparison. |
| opEndsWith | A read-only property used to indicate an "ends with" comparison. |
| opContains | A read-only property used to indicate a "contains" comparison. |
| opNotContains | A read-only property used to indicate a "does not contain" comparison. |
| opNotBeginsWith | A read-only property used to indicate a "does not begin with" comparison. |
| opNotEndsWith | A read-only property used to indicate a "does not end with" comparison. |
| opAnd | A read-only property used to indicate an "and" relationship between other comparisons. |
| opOr | A read-only property used to indicate an "or" relationship between other comparisons. |
| opNot | A read-only property used to indicate a "not" relationship between other comparisons. |
| opAny | A read-only property that can be used with some datasources to retrieve a random record. |
The lasso object has the following methods:
|
Method |
Description |
|---|---|
| getDatabaseNames | Returns an array of database names currently available to Lasso. |
| getTableNames | Returns an array of table names for a specified database. |
Property. The version number of the LassoCommonCode DLL. This property is read
only.
This example places the version of the LassoCommonCode DLL into a variable and then displays it.
var v = lasso.commonCodeVersion;
write("The LassoCommonCode version is: ", v);
=> The LassoCommonCode version is: 3.0
Property. The version number of the Lasso application, plugin or runtime engine. This property is read only.
This example places the version of the Lasso edition into a variable and then displays it.
var v = lasso.editionVersion;
write("The Lasso edition version is: ", v);
=> The Lasso edition version is: 3.0
Property. The name of the platform Lasso is running on.. This property is read only.
This example places the version of the Lasso edition into a variable and then displays it.
var p = lasso.platformName;
write("Lasso is running under ", p);
=> Lasso is running under MacOS
Property. The LassoSession which was created before the JavaScript started executing. This session has already been executed, but it can be executed again once the ResultSet has been closed. This session will contain all the database results and input parameters which were set before the JavaScript started executing.
This example demonstrates how to access the action input parameter of the default Lasso session.
if (lasso.defaultSession.getInputParameters().action == 'nothing')
{ write('No Database Action Occurred'); }
Properties. These properties can be used to set the "operator" property of the SearchColumn object to indicate the type of comparison to use for the specified database field when performing a search.
This example shows how to create a new search field using the lasso.opEquals operator.
// create a new session
var mySession = new LassoSession();
// get a reference to the InputParameters object
var myInput = mySession.getInputParameters();
// set a new searchField with "Group" = "Engineering"
myInput.searchColumns.push(new SearchColumn("Group","Engineering",lasso.opEquals);
See the examples provided for the LassoSession object.
Method. Returns the database names currently available to Lasso.
lasso.getDatabaseNames()
None
An array of strings.
getDatabaseNames returns an array of all the databases Lasso can search or modify (security restrictions may apply). When a new LassoSession is created, the databaseName property can be set to one of the names returned from this method.
This example will get all the available databases from Lasso and print them on to the page.
// get the list of database names
var theList = lasso.getDatabaseNames();
write("The currently available databases are: <br>");
// loop through and print each one
for (var i = 0; i < theList.length; ++i)
{
write(theList[i], "<br>");
}
Method. Returns a list of table (or layout) names for a specified database.
lasso.getTableNames( databaseName )
databaseName is the name of the database for which the table names are to be returned.
An array of strings.
getTableNames will return the names of all the tables available in the specified database. One of these table names can be used to set the tableName property of any LassoSession object.
This example will get the names of all the tables in the fictitious "MyDatabase" and print them out.
// get the list of table names
var tableList = lasso.getTableNames("MyDatabase");
write("The tables in \"MyDatabase\" are:<br>");
// loop through and print the names
for (var i = 0; i < tableList.length; ++i)
{
write(tableList[i], "<br>");
}