Why both of these codes are not updating the entries in datatable. it is not showing error as well. Someone please tell me how to approach this code.
1. var params5 = {
infoTableName : "InfoTable",
dataShapeName : "MACMON_ProductionPlanDT_DS"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(MACMON_ProductionPlanDT_DS)
var updateDT = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params5);
updateDT.ToolHistoryID=rowDT.ToolHistoryID;
updateDT.MachineName=MachineName;
updateDT.PlannedTimeStart=rowDT.PlannedTimeStart;
updateDT.PlannedTimeEnd=rowDT.PlannedTimeEnd;
updateDT.QualityScore=resultDT.rows[i].QualityScore;
updateDT.QualityScoreUpdatedBy=QualityUpdatedBy;
Things[productionPlannerDT].UpdateDataTableEntries({
sourceType: undefined /* STRING */,
values: updateDT /* INFOTABLE */,
location: undefined /* LOCATION */,
source: undefined /* STRING */,
tags: undefined /* TAGS */
});
-------
2. var params5 = {
infoTableName : "InfoTable",
dataShapeName : "MACMON_ProductionPlanDT_DS"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(MACMON_ProductionPlanDT_DS)
var updateDT1 = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params5);
var updateDT = new Object();
updateDT.ToolHistoryID=rowDT.ToolHistoryID;
updateDT.MachineName=MachineName;
updateDT.PlannedTimeStart=rowDT.PlannedTimeStart;
updateDT.PlannedTimeEnd = rowDT.PlannedTimeEnd;
updateDT.QualityScore=resultDT.rows[i].QualityScore;
updateDT.QualityScoreUpdatedBy=QualityUpdatedBy;
updateDT1.AddRow(updateDT);
Things[productionPlannerDT].UpdateDataTableEntries({
sourceType: undefined /* STRING */,
values: updateDT1 /* INFOTABLE */,
location: undefined /* LOCATION */,
source: undefined /* STRING */,
tags: undefined /* TAGS */
});
}
Solved! Go to Solution.
This worked actually.
var ID=rowDT.ToolHistoryID;
var MName=MachineName;
var TimeStart=rowDT.PlannedTimeStart;
var TimeEnd=rowDT.PlannedTimeEnd;
var QScore=resultDT.rows[i].QualityScore;
var QSUpdatedBy=QualityUpdatedBy;
updateDT.ToolHistoryID=ID;
updateDT.MachineName=MName;
updateDT.PlannedTimeStart=TimeStart;
updateDT.PlannedTimeEnd=TimeEnd;
updateDT.QualityScore=QScore;
updateDT.QualityScoreUpdatedBy=QSUpdatedBy;
Things[productionPlannerDT].UpdateDataTableEntries({
sourceType: undefined /* STRING */,
values: updateDT /* INFOTABLE */,
location: undefined /* LOCATION */,
source: undefined /* STRING */,
tags: undefined /* TAGS */
});
You should try step by step:
updateDT.ToolHistoryID=rowDT.ToolHistoryID;
updateDT.MachineName=MachineName;
updateDT.PlannedTimeStart=rowDT.PlannedTimeStart;
updateDT.PlannedTimeEnd=rowDT.PlannedTimeEnd;
updateDT.QualityScore=resultDT.rows[i].QualityScore;
updateDT.QualityScoreUpdatedBy=QualityUpdatedBy;
These properties are assigned with value from infotable input, is that correct? So try with direct string and numeric service input first, and make the service execute succesfully.
And for updateDT1.AddRow(updateDT);, you may check wether it's useful.
Some of the fields Base Type is "DATETIME". I am getting error while trying to hardcode any value for this in js code.
This worked actually.
var ID=rowDT.ToolHistoryID;
var MName=MachineName;
var TimeStart=rowDT.PlannedTimeStart;
var TimeEnd=rowDT.PlannedTimeEnd;
var QScore=resultDT.rows[i].QualityScore;
var QSUpdatedBy=QualityUpdatedBy;
updateDT.ToolHistoryID=ID;
updateDT.MachineName=MName;
updateDT.PlannedTimeStart=TimeStart;
updateDT.PlannedTimeEnd=TimeEnd;
updateDT.QualityScore=QScore;
updateDT.QualityScoreUpdatedBy=QSUpdatedBy;
Things[productionPlannerDT].UpdateDataTableEntries({
sourceType: undefined /* STRING */,
values: updateDT /* INFOTABLE */,
location: undefined /* LOCATION */,
source: undefined /* STRING */,
tags: undefined /* TAGS */
});