Start page / Template development / Template syntax / Data types / Record

Data type RecordAvailable from FirstSpirit Version 5.2

The data type Record identifies one entry of an FS_INDEX input component (see data type Index). In order to obtain the data object associated with the entry, the entry's string identifier must be obtained via the method getIdentifier() and then resolved using the DataAccessSession object associated with the FS_INDEX input component.

Important The set of functionality supported by the data object (i.e. the amount and type of methods available) depends upon the design of the associated data access plug-in. For more information about the implemention of data access plug-ins, see Plug-In Development > Universal Extensions > Data Access.
final Index myIndex = myFormData.get(null, "myIndex").get();
final DataAccessSession myDataAccessSession = myIndex.createSession(baseContext);

// Walk through all records stored in the input component "myIndex".
for (final Record record : myIndex) {
// Obtain a DataObject from the data access session object using the record's identifier.
final DataObject myDataObject = myDataAccessSession.getData(record.getIdentifier());
// Process myDataObject.
}

Methods on Record objects

The table below lists all methods which can be invoked on objects of data type Record .

The object is generated by the following form objects:
FS_INDEX
Method name Return type Brief description Available since
equals(Object) boolean
getClass Class Class of the invoking object
getIdentifier String The identifier of this record. 5.2.11
isCase(Object) boolean
isNull boolean Checks whether an expression is null (zero)
print void
set(String, Object) Object
toJSON String Convert to a JSON-compatible string representation including necessary quotes and escaping for immediate use. Handles Maps, Collections, Arrays, Numbers, Strings, Boolean, Date, and JsonElement. A date instance will be converted to an ISO-8601 formatted date string. Any object other than above will be converted using its 'toString()' value. 5.2.11
toString String
type String

equals(Object)

Method name Return type Available since
equals(Object) boolean

getClass

The .getClass() (in Bean syntax: .class) method returns the class of the invoking object (cf. java.lang.Class).

Invocation:

$CMS_VALUE(myString.class)$
$CMS_VALUE(myString.getClass())$

Output:

java.lang.String
Method name Return type Available since
getClass Class

getIdentifier

The identifier of this record.
Method name Return type Available since
getIdentifier String 5.2.11

isCase(Object)

Method name Return type Available since
isCase(Object) boolean

isNull

The .isNull() (in Bean syntax: .isNull) method checks whether an expression or object is null , e.g. storeElement.isNull(). In the case of objects with complex values or objects, the object decides when it is null. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isNull() returns a Boolean value as the check result. true is the check result if the expression or object is null and false if not.

Method name Return type Available since
isNull boolean

print

Method name Return type Available since
print void

set(String, Object)

Method name Return type Available since
set(String, Object) Object

toJSON

Convert to a JSON-compatible string representation including necessary quotes and escaping for immediate use. Handles Maps, Collections, Arrays, Numbers, Strings, Boolean, Date, and JsonElement. A date instance will be converted to an ISO-8601 formatted date string. Any object other than above will be converted using its 'toString()' value.
Method name Return type Available since
toJSON String 5.2.11

toString

Method name Return type Available since
toString String

type

Method name Return type Available since
type String

© 2005 - 2022 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2023.1 | Data privacy