This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
ds
|
ds {( localID )} -> Result | ||||||||
Parameter | Type | Description | ||||||
localID | Text |
![]() |
Local ID of the remote datastore to return | |||||
Result | DataStore |
![]() |
Reference to the datastore | |||||
The ds command returns a reference to the datastore matching the current 4D database or the database designated by localID
If you omit the localID parameter (or pass an empty string ""), the command returns a reference to the datastore matching the local 4D database (or the 4D Server database in case of opening a remote database on 4D Server). The datastore is opened automatically and available directly through ds.
You can also get a reference on an open remote datastore by passing its local id in the localID parameter. The datastore must have been previously opened with the Open datastore command by the current database (host or component). The local id is defined when using this command.
Note: The scope of the local id is the database where the datastore has been opened.
If no localID datastore is found, the command returns Null.
Using ds requires that the target database is compliant with ORDA, as specified in the ORDA prerequisites section. The following rules are applied:
For more information about datastore implementation, please refer to the Datastores section.
Using the main datastore on the 4D database:
$result:=ds.Employee.query("firstName = :1";"S@")
C_OBJECT($connectTo;$frenchStudents;$foreignStudents;$firstFrench;$firstForeign)
$connectTo:=New object("type";"4D Server";"hostname";"192.168.18.11:8044")
$frenchStudents:=Open datastore($connectTo;"french")
$connectTo.hostname:="192.168.18.11:8050"
$foreignStudents:=Open datastore($connectTo;"foreign")
//...
//...
$firstFrench:=getFirst("french";"Students")
$firstForeign:=getFirst("foreign";"Students")
//getFirst method
//getFirst(localID;dataclass) -> entity
// ---------------------
C_TEXT($dataClassName;$2;$localId;$1)
C_OBJECT($0)
$localId:=$1
$dataClassName:=$2
$0:=ds($localId)[$dataClassName].all().first()
Product: 4D
Theme: ORDA - DataStore
Number:
1482
Created: 4D v17
Modified: 4D v18
4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)