Select x rows from Dataset for template repeater

View is an expression, not a scripting thing. So you can make a custom dataset property utilizing the view() expression and then grab that in your scripting.

Additionally though if you'd like there is the convenience utilities module Ignition Extensions - Convenience utilities for advanced users

You could also install that and then you can use the expression language in scripting as well with system.util.evalExpresssion if you really want to use view in the scripting directly.