createDynamicIndex

open fun createDynamicIndex(entitySet: String, item: String, vararg items: String)

Define a database index for an entity set. Must not be called after the local database has been opened. Actual creation of the index is deferred until the local database is opened. This function differs from {@link com.sap.cloud.mobile.kotlin.odata.CloudSyncProvider#createIndex(com.sap.cloud.mobile.kotlin.odata.EntitySet, com.sap.cloud.mobile.kotlin.odata.PropertyPath, com.sap.cloud.mobile.kotlin.odata.PropertyPath...) CloudSyncProvider.createIndex} by accepting string-typed parameters. It is applicable even when {@link com.sap.cloud.mobile.kotlin.odata.CloudSyncProvider#metadata CloudSyncProvider.metadata} is not yet available.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.CloudSyncProvider#open() CloudSyncProvider.open}, {@link com.sap.cloud.mobile.kotlin.odata.EntitySet#indexes EntitySet.indexes}, {@link com.sap.cloud.mobile.kotlin.odata.CloudSyncProvider#createIndex(com.sap.cloud.mobile.kotlin.odata.EntitySet, com.sap.cloud.mobile.kotlin.odata.PropertyPath, com.sap.cloud.mobile.kotlin.odata.PropertyPath...) CloudSyncProvider.createIndex}.

Example using proxy classes:
open fun setupService(): kotlin.Unit
{
    val online = OnlineODataProvider("HealthService",
        "http://health.example.com:8080");
    val database = SQLDatabaseProvider("HealthDB", "jdbc:h2:~/health.h2");
    val offline = CloudSyncProvider(online, database);
    offline.encryptionKey = this.dbEncryptionKey();
    offline.createIndex(HealthService.patients, Patient.dateOfBirth,
        Patient.lastName);
    val service = HealthService(offline);
    service.downloadInGroup("PatientGroup", HealthService.patients,
        HealthService.appointments);
    service.downloadInGroup("StaffGroup", HealthService.doctors,
        HealthService.nurses);
    this.healthService = service;
}

Parameters

entitySet

Name of entity set for which index will be created.

item

First item to be indexed. This is a property name (e.g. "Quantity") or property path (e.g. "Address/City").

items

Optional additional items for a composite index.