Global Filter: Single Value select Option with custom SQL

Hi Arcadia Team

I have a global filter in dashboard which is based on a daily snapshot partition key (as_of_date).

This filter is a single value selection using Radio button.

Is there a way to select max(as_of_date) from dataset as the default value selection whenever the dashboard is loaded?

@taddwood - Would you pls check if this is possible or any workaround?

@theena try using this Javascript in a Custom Style and applying it to your Partition Key date filter. It will force the minimum and maximum dates to be the maximum Partition Date in your table:

return function() {

    var f = function() {};
    
    f.version = "1";
    
    f.beforeDraw = function () {
      var test = arcapi.getParameters()
      console.log(test)
      data = arcapi.dataResult().rows()
      console.log(data)
      var minDate = data[0][0]
      var maxDate = data[0][1]
      var settings = arcapi.unsupportedDriver.viz().viz_getSettings();
      var columnName = settings["user_settings"]["daterange_output_parameter"]
      var minParamName = columnName + ".start"
      var maxParamName = columnName + ".end"
      var params = {}
      params[minParamName] = maxDate
      params[maxParamName] = maxDate
      arcapi.sendParameters(params);
    };
    
    return f;
}();