Mustache Syntax for getting the Last Row in Model?

{{$Model.MODELNAME.data.N.FIELD}} (where N is the row index) will get you FIELD from row N in a model. Is it possible to get the last row in the model this way? {{$Model.MODELNAME.data.last.FIELD}} or something?

Thanks!

Depends on what you’re trying to do - it’s fairly simple if you want to update a field (on a newish version of Skuid) or run a branch action. Both can take formulas for doing a calculation, so you just need to do a modellookup that finds the last row of the model. It’s something like…

Add a ui-only formula field (uiIndex) on the object, number, and have the formula be {{index}} (returns the row #).

In the update as result of formula, do something like MODEL_LOOKUP(“model”,“FieldYouWant”,“uiIndex”,{{$Model.model.data.length}} - 1)