I wanted to know if it is possible to dynamically get a specific row from a model by using a UI-Only field that stores the desired row number.

With global merge I can do this - {{$Model.Case.data.75.Age__c}} and that returns the 76th record. What I’d like to know is there a way to replace that 75 with a UI-Only Field merge syntax that stores the row number I want to return.

I tried this: {{$Model.Case.data.{{MyUI-Only}}.Age__c}} but I gave me an error as it doesn’t like the the 2 sets of open braces in a row.

Interesting use case. Why a specific row number? How do you know to get this specific row?

@Pat_Vachon I’m trying to get median case age. Native Salesforce lacks in this department as well. When it comes to showing a true representation of Case age, average is not very accurate because you will always have some outliers that throw things off. The only way I’ve seen to get median with Skuid is a summary value on a table component but I’m building a dashboard and I just want to show the median value in a rich text component.

To get the specific row I have a aggregate model on the case object that is a count on Id field. Then I have a UI-Only formula field that that uses the count divided by 2 and -1 because the the first row in a model is 0. Now the only part I can’t figure out is how to return that specific row from my basic model.

Hey Jason,

You should be able to do something like this by using the formula field’s MODEL_LOOKUP() function on the aggregate and another field on your basic model to maintain the index.

on your aggregate model you would leverage the MODEL_LOOKUP() function to target your basic model, and then on your basic model use a simple formula field returning {{index}} to be targeted

on the aggregate you would end up with something that looks like MODEL_LOOKUP(“Case”,“Age__c”,“basicUiOnly”,{{aggUiOnly}})

and then on the basic model maintain the index simply by having a formula field that returns {{index}}. in our example this is the “basicUiOnly.”

heres some documentation on MODEL_LOOKUP i usually find helpful:

https://docs.skuid.com/latest/en/skuid/formula-function.html#referential-data-access

Thanks Jacob. I didn’t know about the {{index}} function. I initially tried to use the Model Lookup but couldn’t figure out a mutual Key field. I got this working perfectly now.