That will be great as now you are mentioning some other custom code you didn’t mention in original request and also there wasn’t any chance check if code implementation is correct. Anyway simple solution provided also works without any issues.
Good luck on your journey
feel free to close your request as solved