Tuesday, December 14, 2021

How to update record in validTimeState table

        LogisticsPostalAddress  LogisticsPostalAddress;

        select * from HCMWORKER

                where HCMWORKER.PERSONNELNUMBER == '002013'; //68719512003

        TransDate x= today(),y=dateMax();

        select forupdate validtimestate(x) * from LogisticsPostalAddress

                where LogisticsPostalAddress.PRIVATEFORPARTY == HCMWORKER.person;     

        LogisticsPostalAddress.ValidTo = today() -1;

        Info(strFmt("%1",HCMWORKER.Person));

        Info(strFmt("%1",LogisticsPostalAddress.RecId));

        ttsbegin;

        LogisticsPostalAddress.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);

        LogisticsPostalAddress.update();

        ttscommit;