Apama Capital Markets Foundation Documentation : Capital Markets Foundation : Utilities : Configuration Service : Adding rows to a configuration table
Adding rows to a configuration table
To add rows to a configuration store table, or to update an existing row, the application must first generate a key for the row. The key is generated from the sequence of values for the index fields specified in the table schema. Note that the key values for non-string fields, such as integer, float and boolean, must be converted to strings when generating the key. As with most configuration service operations, adding or updating a row is an asynchronous operation so the application must wait for it to complete before assuming that the row was successfully added:
// Called when the sample table has been created or retrieved
action onSuccess2(integer id,
com.apama.config.ConfigurationTableInterface _table) {
 
log "TestTable created or retrieved successfully" at INFO;
 
// Add a new row
sequence<string> keyseq := ["aString"];
key := _table.makeKey(keyseq);
if key.length() < 1 then {
log "Failed to create key for new row" at ERROR;
return;
}
else {
log "Key for new row is: "+key at INFO;
}
 
if _table.hasRow(key) then {
log "New row already exists!" at ERROR;
return;
}
else {
com.apama.memorystore.Row row := _table.getRow(key);
row.setString("stringField", "aString");
row.setInteger("integer", 42);
_table.updateRow(integer.getUnique(), key, row, onSuccess3, onError);
}
}

// Called if the new row is successfully created
action onSuccess3(integer id) {
 
log "New row created!" at INFO;
}
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback