Fixing automatic detection of select type based on variables present in
the view