I have a status field with options (Open, Partials, Finished, Blank) in a list page which updates based on multiple conditions, its working fine but when I filtered the status Open its showing records of other status as well , please check below screenshots
see i have set the status to open the condition for open status is when Folding Glueing Glued Pcs is 0 the status will be open

but see the status is Open where there is value in Folding Glueing Glued Pcs but see the Work Order No

when i filtered the Work Order No the Line vanishes

but then i removed the filter of status the line is showing with status blank which is correct as the condition for blank status is Folding Glueing Glued Pcs greater than Required Quantity

So this is the issue the status is calculating properly but on filtering its showing wrong records
the code done is below, please guide what to do to resolve this issue or whats done wrong here.
trigger OnAfterGetRecord()
var
myInt: Integer;
begin
UpdateStatus(rec."Work Order No");
end;
local procedure UpdateStatus(WorkOrderNo: Code[20])
var
tblWorkOrder: Record EVS_WorkOrderHeader;
begin
tblWorkOrder.Init();
tblWorkOrder.Reset();
tblWorkOrder.SetRange(tblWorkOrder."Work Order No", WorkOrderNo);
if tblWorkOrder.FindSet() then begin
if tblWorkOrder."Word Order Status" <> tblWorkOrder."Word Order Status"::Finished then begin
if tblWorkOrder."FG Glued Pcs" = 0 then begin
tblWorkOrder."Word Order Status" := tblWorkOrder."Word Order Status"::Open;
end else if tblWorkOrder."FG Glued Pcs" < tblWorkOrder."Required Quantity" then begin
tblWorkOrder."Word Order Status" := tblWorkOrder."Word Order Status"::Partial;
end else if tblWorkOrder."FG Glued Pcs" = tblWorkOrder."Required Quantity" then begin
tblWorkOrder."Word Order Status" := tblWorkOrder."Word Order Status"::Finished;
end else if tblWorkOrder."FG Glued Pcs" > tblWorkOrder."Required Quantity" then begin
tblWorkOrder."Word Order Status" := tblWorkOrder."Word Order Status"::" ";
end;
tblWorkOrder.Modify();
end;
end;
end;