Can you use any merge syntax in calculation UI only fields?

  • 1
  • Question
  • Updated 3 years ago
I figured I'd ask this question before I spend a ton of time on trial and error. I want to use a UI only field to add the lengths of various models. It seems I would just do something like:
{{$Model.MyModel1.data.length}}+{{$Model.MyModel2.data.length}+{{$Model.MyModel3.data.length}

I remember trying something like this in the past and not having luck. Would this approach work in a UI only calc field or is there another way that I need to pursue this?
Thanks
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
You should totally be able to do this.   Here are some caveats. 

1. Model 1 and Model 2 have to be above the model where your UI only calculation is occuring.  Can't calculate what isn't yet known....
2. {{$Model.MyModel1.data.length}} will return a string.  You need to wrap it in a "VALUE()" function to translated it into a number that can be calculated. 

Start your formula very simply and then build complexity as you are successful with prior stages...  It makes debugging much more straightforward. 
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Great, thanks!
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Follow up question. How do I reference my newly created UI field in a template. My current attempt is not working:
{{$Model.ServiceRequestDashboard.data.0.ServiceCountAgg}}