Hi, Thanks for your reply.
Now i have used that ValidTimestate function and written the code. Still the count of terminated employees are showing zero only.
static void communityattrition( Args args)
{
HcmWorker hcmworker, hcmworker1;
HcmWorkerAction hcmWorkerAction;
HcmEmployment hcmemployment, hcmemployment1;
ITTI_Attrition_Temp attritiontemp, attritiontemp2;
HcmWorkerStatus workerStatus = HcmWorkerStatus::Terminated;
int counter1=0, counter2=0 ;
utcdatetime now = DateTimeUtil::utcNow();
utcdatetime minDateTime = DateTimeUtil::minValue();
utcdatetime maxDateTime = DateTimeUtil::maxValue();
utcDateTime date1 = DateTimeUtil::newDateTime(1\7\2015, 0);
utcDateTime date2 = DateTimeUtil::newDateTime(31\7\2015, 0);
while select ValidTimeState(date1, date2) * from hcmEmployment
{
select hcmworker where hcmworker.recid ==hcmemployment.worker;
if( hcmemployment.ValidFrom >= date1 && hcmemployment.ValidFrom <= date2
&& hcmworker.workerStatus()== HcmWorkerStatus::Employed)
counter1++;
else if(hcmemployment.ValidTo <= date2 && hcmworker.workerStatus() == HcmWorkerStatus::Terminated)
counter2++;
}
info(strFmt("%1, %2" , counter1, counter2));
}
In the above code, if i put the debugger and checked that Terminated employee RecId's are not selecting at all .