Hi,
Have two date fields for which I need to calculate the difference in days, i.e. UsrEndDate- UsrStartDate = UsrDayDifference
I have implemented the following code so far:
define("AccountPageV2", [], function() {
return {
entitySchemaName: "Account",
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
attributes: {
"UsrDayDifference": {
dataValueType: Terrasoft.DataValueType.FLOAT,
dependencies: [
{
columns: ["UsrStartDate", "UsrEndDate"],
methodName: "calculateDays"
}
]
}
},
methods: {
onEntityInitialized: function() {
this.callParent(arguments);
this.calculateDays();
},
calculateDays: function() {
var result = (this.get("UsrEndDate") - this.get("UsrStartDate")).TotalDays;
this.set("UsrDayDifference", result);
}
},
diff: /**SCHEMA_DIFF*/[
{
............
Can someone please explain what I'm doing wrong here?
Thank you,
Eduan