Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When a user types a value into a text field (which is bound to a specific column of the database table) and clicks out, the Servoy Application Server issues a SQL update command to the database to modify the selected record. The resulting change is also broadcast|display/DOCS/Data+Broadcasting|||||||||||||||||||||||||||||||||||||||\ to all connected clients.

...

The fundamental unit of data binding in both the GUI and the API is the Servoy Foundset|display/DOCS/Foundsets+Concepts|||||||||||||||||||||||||||||||||||||||\ object.

...

This essentially has the effect of issuing a SQL UPDATE statement using the WHERE clause that constrains the foundset. This presents a significant performance advantage over updating records individually. In the example below, a related foundset is updated, meaning all orders belonging to the selected customer will be affected.

Code Block
var fsUpdater = databaseManager.getFoundSetUpdater(foundset);// Updates all the records in the foundsetvar fsUpdater = databaseManager.getFoundSetUpdater(customers_to_orders);
fsUpdater.setColumn('status',101);
fsUpdater.performUpdate();

...

Code Block
/**/**
 * Record after-insert trigger.
 *
 * @param {JSRecord} record record that is inserted
 *
 * @properties={typeid:24,uuid:"92834B20-1CAC-472F-B022-DD97FEFEA792"}
 */
function afterRecordInsert(record) {
	if(record.projects_to_projects_users.newRecord()){				// create a link record
		record.projects_to_projects_users.user_id = globals.currentUserID;	// associate to current user
		databaseManager.saveData();
	}
}

Using Table Filters

Servoy provides high-level filtering functionality which may be applied to any database table using the addTableFilterParam method of the databaseManager API. Table filters have the following properties:

  • Scope - A filter may be applied to a single database table or, if no table is specified, an entire server connection. A filter will constrain the records which are returned by any queries that are issued from the Servoy client to the table(s). A filter takes effect immediately upon being added and remains in effect for the duration of the client session unless programmatically removed. The constraints of a filter apply to all facets of a Servoy solution, including: 
    • foundsets
    • related foundsets
    • value lists
Note

There is only one way to circumvent a table filter - by issuing a custom SQL query through the getDataSetByQuery method of the databaseManager API. Therefore, if one wishes to maintain the effects of a filter, it is important to remember to modify such queries with an appropriate SQL WHERE clause.

  • Logical Expression - A filter will contain a logical expression which is evaluated on behalf of records in the filtered table(s). Only records, for which the expression evaluates to true, will be returned by any queries issued to the filtered table(s). At runtime, the filter will be translated into an SQL WHERE clauseand appended to the query of any foundset which is bound to the filtered table(s). An expression contains the following components:
    • Data Provider Name - This is the left-hand operand. It is the name of a single column by which to filter. When filtering an entire server connection, only tables which contain the named column will be filtered.
    • Operator - The following operators are supported 

      =

      <

      >

      >=

      <=

      !=

      LIKE

      IN

    • Data Provider Value - This is the right-hand operand and should evaluate to a literal value to be compared with the named column.
Note

When using the IN operator, one should provide a comma separated list of values

  • Filter Name - When adding a table filter parameter, a filter name may be used to allow for the later removal of a named filter. Multiple parameters or conditions may be set using the same filter name. In this case, all parameters may be removed at the same time.
    Tasklist
    
    ||Completed||Priority||Locked||CreatedDate||CompletedDate||Assignee||Name||
    |T|M|F|          |1303223270557|sdevlin|Updating the client cache?|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?p=85478#p85478 |
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?p=85475#p85475 |
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?p=78242#p78242 |
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?p=78547#p78547 |
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?p=77967#p77967 |
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=22&t=11684#p75081|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=22&t=11684#p75081|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=13&t=14089#p74182|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=22&t=14078#p74018|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=4&t=13931#p73033|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=22&t=13885#p72762|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=22&t=13646#p71003|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=3&t=13280#p68498|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=3&t=13276#p68496|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=22&t=13218#p68248|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=22&t=13171#p67928|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?f=8&t=13158#p67832|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?p=85817#p85808|
    |F|M|F|          |          | |http://forum.servoy.com/viewtopic.php?p=85817#p85817|
    |F|M|F|1302710297259|          |sdevlin|Programming Table Filters|
    |F|M|F|1302710463580|          |sdevlin|Using a JSDataSet as a data source|
    |F|M|F|1302710518262|          |sdevlin|Aborting Find mode|
    |F|M|F|1302710564609|          |sdevlin|Audit Logging!|
    |T|M|F|1302711045480|1303328879920|sdevlin|JSFoundsetUpdater|
    |F|M|F|1302711649686|          |sdevlin|Difference Between Controller and Foundset|
    |F|M|F|1302711717330|          |sdevlin|Filtering: Foundsets and Tables|
    |F|M|F|1302711812803|          |sdevlin|Link to Performance Statistics in Deployment Guide|
    |F|M|F|1302711904829|          |sdevlin|Foundsets: Iterating|
    |F|M|F|1302711943338|          |sdevlin|Foundsets: Load Records|
    |F|M|F|1302713173399|          |sdevlin|Link to DataBroadcast Event|
    |F|M|F|1303225694915|          |sdevlin|Calculations: Used as a variable|
    |F|M|F|1303225717501|          |sdevlin|Column Properties: Auto-Enter Lookups Link to relookup()|
    |F|M|F|1309183255640|          |sdevlin|APP_UI_PROPERTY.LEAVE_FIELDS_READONLY_IN_FIND_MODE|