main.jsfile, you can create a query that pulls all punch list items from the database and stores them in the view variable
view.prefix. This allows you to differentiate between view variables and JS variables with the same name.
DB.itemis automatically made available because we've defined the
itemObject Type in our Data Model.
<object-list>— however, we only want to show punches that have "Open" as their status (as defined in our Data Model). This can be done by filtering the query. To retrieve only the "Open" punches, change your code to the following:
where()function is a string specifying the condition of how we want to match objects, and the arguments thereafter are the values that we are actually matching against.
init()function, which contains your query, only runs when you open a view (when the view loads), so to run the query again, you need to re-open your Main View.