Skip to main content

Posts

Showing posts with the label str2num

Calculate Time Consumption in hours in Ax 2012

Code to get total time consumed between two times means if time one is 14:10 and time two is 15:40 then you want to get difference time in hours only like in this example it will be 1.5 hours. Getting time in hours in very difficult but you can get it easily by writing one simple method. # int seconds, minutes, hours, totalTime; # str timeStr = "",minstr=""; # # if (_startTime > _endTime) # { # totalTime = _endTime + (str2time('23:59:59') - _startTime); # } # else # { # totalTime = _endTime - _startTime; # } # # seconds = totalTime mod 60; # minutes = totalTime mod 3600 div 60; # hours = totalTime div 3600; # # if (hours > 0) # if (hours == 1) # timestr = timeStr + strFmt("%1", hours); # else # timestr = timeStr + strFmt("%1", hours); # #

Update records and grid in MSD axapta x++ language

Update records and grid in axapta x++ language public void Update_test_Emp_Travel() { ; ttsbegin; Select forUpdate test_Emp_Travel where test_Emp_Travel.SrNo == str2num(rlSrNo_Update.valueStr()); test_Emp_Travel.Employee_Name = strEmployeeName_Update.valueStr(); test_Emp_Travel.Travelling_Through = str2enum(test_Travelling_Through,cmbTravellingThrough_Update.valueStr()); test_Emp_Travel.update(); ttscommit; test_Emp_Travel_ds.reread(); test_Emp_Travel_ds.refresh(); test_Emp_Travel_ds.research(true); test_Emp_Travel_ds.executeQuery(); element.ClearField_Update(); GridEmpTravel.update(); GridEmpTravelDetails.update(); }