Set "Having" with JavaScript?

edited October 2019 in Questions
Does anyone know how I would set "Having" (as described in the following community post) via JavaScript Snippet? I would like to create a table filter based on Having. Thanks! https://community.skuid.com/skuid/topics/filter_on_count

Comments

  • Zach McElrathZach McElrath Skuad
    edited March 2017
    "Havings" / "Post-Aggregation Conditions" can be set via JavaScript using the same API's that are used for setting "Pre-Aggregation Conditions": getConditionByName( ) and setCondition( ). getConditionByName( ) will search through both Pre- and Post- Aggregation Conditions when searching for name matches, and setCondition( ) works on either Pre- or Post- Aggregation Conditions.

    For instance, if you have an Aggregate Model named "AggData" with a "Having" Condition named "recordCount", you can set the value of this Condition from JavaScript like this:
    var model = skuid.$M("AggData");
    var recordCountCondition = model.getConditionByName("recordCount");
    model.setCondition(recordCountCondition, 42);
  • edited October 2019
    Zach To the Rescue! I Always appreciate everyone's help. Thanks!
  • Chandra VChandra V Member
    edited February 2019
    Just wanted to say Thanks for this also.  We implemented 'Havings' on our community Skuid page to expose our available inventory.  One of our filters is on quantity, and we needed that post aggregation condition on our model to sum the inventory quantities together and the return results.  Used a JS snippet to set the condition and return the results.  Good stuff.
Sign In or Register to comment.