Constructor for a data model calculation. SDK users are not expected to invoke this constructor directly.
Constructor for a data model calculation. SDK users are not expected to invoke this constructor directly.
Name | Type | Description |
---|---|---|
props | Object | A dictionary of properties to set: |
init: function(props) {
props = props || {};
props.owner = props.owner || "";
this.id = props.calculationID;
this.type = props.calculationType;
this.comment = props.comment || null;
this.editable = props.editable;
this.lineage = props.owner.split(".");
this.owner = this.lineage[this.lineage.length - 1];
this.outputFields = [];
for (var i = 0; i < props.outputFields.length; i++) {
this.outputFields[props.outputFields[i].fieldName] = new root.DataModelField(props.outputFields[i]);
}
if ("Eval" === this.type || "Rex" === this.type) {
this.expression = props.expression;
}
if ("GeoIP" === this.type || "Rex" === this.type) {
this.inputField = props.inputField;
}
if ("Lookup" === this.type) {
this.lookupName = props.lookupName;
this.inputFieldMappings = props.lookupInputs[0];
}
},
Is this data model calculation editable?
True if this data model calculation is editable.
isEditable: function() {
return !!this.editable;
},
Is this data model calculation of type eval?
True if this data model calculation is of type eval.
isEval: function() {
return "Eval" === this.type;
},
Is this data model calculation of type GeoIP?
True if this data model calculation is of type GeoIP.
isGeoIP: function() {
return "GeoIP" === this.type;
}
});
Is this data model calculation of type lookup?
True if this data model calculation is of type lookup.
isLookup: function() {
return "Lookup" === this.type;
},
Is this data model calculation of type Rex?
True if this data model calculation is of type Rex.
isRex: function() {
return "Rex" === this.type;
},
Returns an array of strings of output field names.
An array of strings of output field names.
outputFieldNames: function() {
return Object.keys(this.outputFields);
},