Update records using Function

Update records using Function

Hi,

I am trying to create a function that will update the respective fields when it meets the respective criteria . see below form screenshot , there you can see the Coverage-01 and Coverage-02 are blank. I want to input "Full" in the coverage fields if respective MVPD fields is not null.

like - for station : TV1 , the MVPD-01 is not blank so Coverage-01 field should be updated by "Full" but Coverage-02 should be blank since MVPD-02 is blank.

I was  trying to use below Script but not working

**********************************************

void Test.UpdateCovera_SubChane()
{
    for each rec in  MVPD   sort by  Added_Time desc range from 1 to 100
    {
if ( rec.MVPD01 != null)
{
        rec.Coverage_01 = "Full";
}
if ( rec.MVPD02 != null)
{
        rec.Coverage_02 = "Full";
}
    }

*******************************






Actual Table:



Expected Output: 




Could any one please help me to fix the bug.

Thanks

Arfater.