How to simulate a select