Announcements
No record found.
Hello there,
What should I do to get results in hours when I receive the difference of the two fields that are ExtendedDataType SechedFromTime?
Ex: StartHour - EndHour : 12:30
*This post is locked for comments
Subtract StartHour from EndHour and converted the result to a formatted string with time2StrHM().
This field is displayed. Result from the following code : Example : 3,67 hour
But i want result: 4:07 hour
server display Hours TotalTime()
{
DRT_ProdOpReportTrans ProdOpReportTrans;
Hours hours = 0;
;
while select ProdOpReportTrans
index hint ProdLineIdx
where ProdOpReportTrans.ProdId == this.ProdId
if(ProdOpReportTrans.End == NoYes::Yes || ProdOpReportTrans.Start == NoYes::Yes )
hours = (ProdOpReportTrans.dispEndProdHour() - ProdOpReportTrans.dispStartProdHour()) / str2Time('00:60');
}
return hours;
How can I do that?
I already gave you the answer in my first reply - use time2StrHM(). Here is a concrete example:
timeOfDay time1 = timeNow(); timeOfDay time2 = time1 + 90*60; str s = time2StrHM(time2 - time1);
By the way, it makes no sense to use a while select if you always return just the last value. Either you wanted to do an aggregation and you forgot, or you added the loop by mistake. Also, your checks for Start and End should be in the query - you're wasting resources to fetch records you don't want.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CP04-islander 39
Michel ROY 14
imran ul haq 8