How to use select statements instead of query in data source

Override FormDataSource method executeQuery:

    public void executeQuery()
    {
        SomeTable T = this.cursor();

        select * from T where …;
    }

But be aware that in this case grid will not support sorting and filtering.