dynamically show edit and copy menu on preview

Hi…
on master/detail, I put this script on server event → table specific-Preview Page–> listOption_rendered (V2022)

    $rs = ExecuteRow("SELECT * FROM ser WHERE nadir="DEB"");
    $rs->MoveFirst(); 
    while (!$rs->EOF) { 
        $this->ListOptions->Items["edit"]->Body = "";
        $this->ListOptions->Items["copy"]->Body = "";
        $rs->MoveNext(); 
    } 
    $rs->Close();

i want to dynamically show edit and copy menu base on field nadir… but record doesnt show, there is many data in that table
how to solve this…
thank you

Wrong recordset loop implementation in v2022.

Please refer to this topic if you want to loop through recordset in v2022.

In addition, for your case, it seems you only need to compare the certain value of certain field in order to hide the Edit and Copy button/link. In other words, no need to compare the value through loop of recordset.

Thank you so much