Lookup_Selecting

Hi, I tried to put a same code in PM2019 and 2020 below (Im sure I have no other custom codes yet except this one):

function Lookup_Selecting($fld, &$filter) {
$koderombel = $this->Kode_Rombel->CurrentValue;
$tahun = ExecuteScalar(“SELECT Tahun_Masuk From si_Rombel WHERE Kode_Rombel = ‘$koderombel’”);
$filter = $tahun;
$fld->Lookup->UserFilter = “Tahun_Masuk = ‘$filter’”;
}

in V2019 filtering and autofill booth run smooth
in V2020 filtering runs smooth, autofill not

Did i miss a thing ? Thanks

Yes. In v2020, you need to check/make sure first, whether the CurrentValue that belongs to the field exists or not, for example:

function Lookup_Selecting($fld, &$filter) {
if (!empty($this->Kode_Rombel->CurrentValue)) {
$koderombel = $this->Kode_Rombel->CurrentValue;
$tahun = ExecuteScalar(“SELECT Tahun_Masuk From si_Rombel WHERE Kode_Rombel = ‘$koderombel’”);
$filter = $tahun;
$fld->Lookup->UserFilter = “Tahun_Masuk = ‘$filter’”;
}
}

SOLVED.
I see. I applied that and autofill working smooth just like a silk. Thank you