From my own documentation when I dealed with it:
"Standard AddDataTableEntry service, returns the newly created id, which it's totally unuseful, you can't query entries by this id, but you can query entries with "key", then we return the corresponding newly created "key" value not the id."
Then based on the values passed as password I have this code to recover the real newly created key:
var result = "";
var rowValues = values.rows[0];
var nVmepk = me.pk.rows.length;
var entry;
for (var i=0;i<nVmepk;i++) {
entry = me.pk.rows[i];
if ((entry.baseType==="INTEGER")||(entry.baseType==="LONG")) {
result += (""+parseInt(rowValues[entry.name],10));
} else {
result += rowValues[entry.name];
}
}
The previous code depends on having a property called pk with Infotable Pk fields
this pk fields property can be filled with:
// -- Calculate Primary Keys
var dsName = me.GetDataShape();
var ds = DataShapes[dsName];
var fields = ds.GetDataShapeMetadataAsJSON().fieldDefinitions;
me.pk = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName : "InfoTable",
dataShapeName : "FieldDefinition"
});
me.pk.AddField({ name: "ordinal", baseType: "INTEGER" });
for (var property in fields) {
if (fields.hasOwnProperty(property)) {
if (fields[property].aspects) {
if (fields[property].aspects.isPrimaryKey) {
me.pk.AddRow({
name: property,
isPrimaryKey: true,
baseType: fields[property].baseType,
description: fields[property].desription,
dataShape: dsName,
ordinal: fields[property].ordinal
});
}
}
}
}
Just my experience.