Ojbect. An InputParameters object is used to define the criteria for a database action. It is used to establish the database name, table name, action type (search, update, delete, etc.), search parameters and other important variables use when a LassoSession is executed.
An InputParameters object is obtained only through the LassoSession object which contains it. Every LassoSession object contains exactly one InputParameters object. If a session has already been executed (i.e. the default session or any session where the execute method has already been called), the InputParameters object can be use to determine what action was taken.
The InputParameters object has the following properties:
Property |
Description |
---|---|
action | The database action which will be performed. |
logicalOperator | The operator to be used to searches. |
databaseName | The name of the database the action will be performed on. |
tableName | The name of the table or layout the action will be performed on. |
userName | The user name which will be used to determine the security privileges for the action. |
password | The password used when validating the user. |
searchColumns | An array of SearchColumn objects which contain the input field names and values. |
sortColumns | An array of SearchColumn objects containing sort parameters. |
returnColumns | An array of field names which will be used to build the result set. |
primaryKeyName | The name of the primary key used in updates, deletes, duplicates and single record searches. |
primaryKeyValue | The value of the primary key. |
skipRecords | The number of result records to be skipped when building the result set. |
maxRecords | The maximum number of records to be included in when building the result set. |
Property. The database action which will be performed when the session is executed. Currently supported values for this property are:
Some actions may not be supported by every datasource.
This example shows how to set the action property.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // set the action myInput.action = "search";
See the examples provided for the LassoSession object.
Property. The logical operator used for the database action. Currently supported values for this property are:
This example shows how to set the logicalOperator property.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // set the logical operator myInput.logicalOperator = "OR";
See the examples provided for the LassoSession object.
Property. The name of the target database.
This example shows how to set the databaseName property.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // set the database name myInput.databaseName = "MyDatabase.db";
See the examples provided for the LassoSession object.
Property. The name of the target table or layout.
This example shows how to set the tableName property.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // set the table/layout name myInput.action = "MyTable";
See the examples provided for the LassoSession object.
Property. The user name which will be used to determine security permissions for the database action. If this property is left blank, the action is anonymous and "All Users" security permissions will apply.
This example shows how to set the userName property.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // set the user name myInput.userName = "administrator";
See the examples provided for the LassoSession object.
Property. The password used to validate the userName property.
This example shows how to set the password property.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); //set the user name myInput.userName = "administrator" // set the user name's password myInput.password = "myPassw0rd";
See the examples provided for the LassoSession object.
Property. An array of SearchColumn objects which contain input field names and values. The names and values are used to hold any search criteria, update information or data to use when creating a new record.
This example shows how to create a new search field.
// 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.
Property. An array of SearchColumn objects which contain sorting information. When adding a new sort field to this array, the SearchColumn object's "name" property will contain the name of the database field to sort by and the "value" property should be set to either "ascending" or "descending" depending on the direction the results should be sorted.
This example shows how to create a new sort field.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // sort the results by the "Group" field myInput.sortColumns.push(new SearchColumn("Group","ascending"));
See the examples provided for the LassoSession object.
Property. An array of field names which will be included in the result set. If no return fields are specified, all available fields will be included.
This example shows how to create new return fields.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // only return the "First Name" and "Last Name" myInput.returnColumns.push("First Name"); myInput.returnColumns.push("Last Name");
See the examples provided for the LassoSession object.
Property. The name of the field to use as a primary key when performing an update, delete, duplicate or single-record search.
Note
Not every database will use primary key names. (e.g.: FileMaker Pro)
This example shows how to set the primaryKeyName property.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // set the primary key name myInput.primaryKeyName = "SomeFieldName"; // set the primary key value myInput.primaryKeyValue = "SomeValue";
See the examples provided for the LassoSession object.
Property. The value for the primary key field specified in the primaryKeyName property. This value will be matched to the value of a particular record in the target database. The found record will be used or returned when performing an update, delete, duplicate or single-record search.
Note
If a database does not require a primary key, it will usually require a unique record ID to be used as the primary key value.
This example shows how to set the primaryKeyValue property.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // set the primary key name myInput.primaryKeyName = "SomeFieldName"; // set the primary key value myInput.primaryKeyValue = "SomeValue";
See the examples provided for the LassoSession object.
Property. The number of records to skip when constructing the result set. For example, if 36 records were found in a query, and this property was set to 15, only records 16 through 36 would be returned in the result set.
This property can be used along with the maxRecords property to return result records within a specific range.
This example shows how to set the skipRecords property.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // set the skipRecords myInput.skipRecords = 1;
See the examples provided for the LassoSession object.
Property. The maximum number of records to include in the result set. For example, if 36 records were found in a query and this property was set to 15, only records 1 through 15 would be included in the result set.
This property can be used along with the skipRecords property to return result records within a specific range.
This example shows how to set the maxRecords property.
// create a new session var mySession = new LassoSession(); // get a reference to the InputParameters object var myInput = mySession.getInputParameters(); // set the maxRecords myInput.skipRecords = 5;
See the examples provided for the LassoSession object.