Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Solved! Go to Solution.
You can use below script to increase startime & endtime by 1 hour
let startTime = new Date();
// End Time plus 1 hour from startTime
let endTime = dateAddHours(startTime, 1);
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(TestDS1)
let result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName: "InfoTable",
dataShapeName: "TestDS1"
});
// Iterate
let i = 0;
while (i < 5) {
/*
LOGICS
*/
result.AddRow({
"StartDate": startTime,
"EndDate": endTime
});
// StartTime & EndTime will increase at end of iteration
startTime = endTime;
endTime = dateAddHours(startTime, 1);
i++;
}
Output :
/VR
Hi @Hrishabh.Sharma ,
If you observe any the vast majority of the requests for help in this forum, you will observe that they follow a specific structure, where the user explains what they want to do and what the issue is.
Would you be able to explain what are you trying to achieve and where exactly you encountered issues?
I observed you posted just the code in the section where you should explain these things I mentioned above, and also the title does not clarify these as well.
Hi @VladimirRosu,
Most of things, i have posted just for future reference to itself and others, I am not asking to anybody for answers.
You can use below script to increase startime & endtime by 1 hour
let startTime = new Date();
// End Time plus 1 hour from startTime
let endTime = dateAddHours(startTime, 1);
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(TestDS1)
let result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName: "InfoTable",
dataShapeName: "TestDS1"
});
// Iterate
let i = 0;
while (i < 5) {
/*
LOGICS
*/
result.AddRow({
"StartDate": startTime,
"EndDate": endTime
});
// StartTime & EndTime will increase at end of iteration
startTime = endTime;
endTime = dateAddHours(startTime, 1);
i++;
}
Output :
/VR