Child pages
  • JSDataSource
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Refresh page May 02, 2024 19:53

Supported Clients
SmartClient WebClient NGClient

Methods Summary
QBSelect createSelect() Create a query builder for a data source.
QBSelect createSelect(tableAlias) Create a query builder for a data source with given table alias.
Array getColumnNames() Get the column names of a datasource.
String getDataSource() Get the datasource string.
JSFoundSet getFoundSet() Returns a foundset object for a specified datasource or server and tablename.
JSFoundSet getFoundSet(name) Returns a named foundset object for a specified name.
JSTable getTable() Get the table of a datasource.

Methods Details

createSelect()

Create a query builder for a data source.

Returns

QBSelect query builder

Supported Clients

SmartClient,WebClient,NGClient

Sample

var q = datasources.db.example_data.book_nodes.createSelect()
 q.result.addPk()
 q.where.add(q.columns.label_text.not.isin(null))
 datasources.db.example_data.book_nodes.getFoundSet().loadRecords(q)

createSelect(tableAlias)

Create a query builder for a data source with given table alias.
 The alias can be used inside custom queries to bind to the outer table.

Parameters

String tableAlias the table alias to use

Returns

QBSelect query builder

Supported Clients

SmartClient,WebClient,NGClient

Sample

var q = datasources.db.example_data.book_nodes.createSelect('b')
 q.result.addPk()
 q.where.add(q.columns.label_text.isin('select comment_text from book_text t where t.note_text = ? and t.node_id = b.node_id', ['test']))
 datasources.db.example_data.book_nodes.getFoundSet().loadRecords(q)

getColumnNames()

Get the column names of a datasource.

Returns

Array String[] column names

Supported Clients

SmartClient,WebClient,NGClient

Sample

 

getDataSource()

Get the datasource string.

Returns

String String datasource

Supported Clients

SmartClient,WebClient,NGClient

Sample

datasources.db.example_data.orders.getDataSource() // returns 'db:/example_data/orders'

getFoundSet()

Returns a foundset object for a specified datasource or server and tablename.
It is important to note that this is a FACTORY method, it constantly creates new foundsets.

Returns

JSFoundSet A new JSFoundset for the datasource.

Supported Clients

SmartClient,WebClient,NGClient

Sample

var fs = datasources.db.example_data.orders.getFoundSet()
var ridx = fs.newRecord()
var record = fs.getRecord(ridx)
record.emp_name = 'John'
databaseManager.saveData()

getFoundSet(name)

Returns a named foundset object for a specified name. If named foundset datasource does not match current datasource will not be returned.
If named foundset is not created will return null.

Parameters

String name The named foundset to get for this datasource.

Returns

JSFoundSet An existing named foundset for the datasource.

Supported Clients

SmartClient,WebClient,NGClient

Sample

var fs = datasources.db.example_data.orders.getFoundSet('myname')
var ridx = fs.newRecord()
var record = fs.getRecord(ridx)
record.emp_name = 'John'
databaseManager.saveData()

getTable()

Get the table of a datasource.

Returns

JSTable JSTable table

Supported Clients

SmartClient,WebClient,NGClient

Sample

 

  • No labels