Problem with aggregate model conditions using UI only Field

edited October 2019 in Questions
-Still on Rockaway. - I have an aggregate model. It has a sum aggregation on number of minutes. This (obviously) totals the number of minutes from all of the records that match the condition criteria of "Last Month". -This works great, except that I need the model to only load records where the summed minutes are greater than 20. -I built a UI only formula field that is equal to the sum of minutes aggregation. This works the field displays the correct number in the table. -The problem is that I then create a condition based on the UI only field that says to only display if the UI only field is greater than 20. -This condition doesn't work. All records are displayed regardless of minutes. Any Ideas?

Comments

  • J.J. 💎
    edited October 2019
    Raymond,

    Conditions on Ui-Only fields are only used for setting default values when rows are created at present. However, I think the functionality you are after is presently in Skuid, just only available via XML editing (and only for Salesforce models, by the way). Did you try the "HAVING" approach?
  • edited October 2019
    I did not try having. I found this post, which may explain my issue and also a summary of the XML hack required. I'll update this post with my results. Thanks! https://community.skuid.com/skuid/topics/filter_on_count
  • edited October 2019
    Ha! I see we are talking about the same post! I just clicked your link and saw it took me to the same link as the one I found. Thanks, J...... i
  • edited October 2019
    Good luck Raymond, I'm interested to see how you go as I tried aggregating UI only fields in the past with no luck and used javascript to achieve the desired result. 
  • edited October 2019
    IT WORKED! First Try! Thanks J. and Zach. This is hugely useful to me. I have a couple other places I have been using band aids that I can fix with this. Glad I asked the Community!
  • edited December 2016
    Hi Damien, The solution prescribed in the link in the comments worked for me. I wasn't trying to aggregate A UI field, however. I was trying to filter a table based on an aggregate value and was trying to use a UI field to accomplish that. ultimately I was barking up the wrong tree and what I needed was "Having". Good luck!
  • edited December 2016
    Thanks for the clarification, still very useful to know.
  • edited December 2016
    I have a new tweak to this: For certain reasons, I have a basic model that has a UI only field which looks up a value on an aggregate model to pull an aggregate sum. This works great. However, if I build a condition in the basic model based on the UI field (which I think I should be able to), the query ignores the condition. I am wondering if it is because, even though the aggregation occurs in a different model, a model condition can't be build on a UI field that uses info from a model aggregation? Would Having work on a basic model?
  • edited December 2016
    I Got it after a lot of trial and error. Seems like an issue with page builder. It wasnt adding the alias name from the aggregate model grouping into the condition parameters. I hacked the the xml and replaced the object field name with the aggregate field alias and it worked. Having, in case you are interested, did not cause an error when I added it to a basic model, but it didn't seem to do anything.
  • edited December 2016
    Last question on this: Can you set having through javascript and what would that look like? I would like to be able to create a table filter based on having.
Sign In or Register to comment.