cancel
Showing results for 
Search instead for 
Did you mean: 
Community_Admin
Community Team Member
Community Team Member

Question

Is there a way to tie a default filter (set to "all") so that instead of Blox just displaying the top name in from the data, it triggers a custom phrase instead (like "Aggregate")?

Answer

Here's a simple way to do something of the kind!  Two steps:

1. Give the TextBlock containing the customer name an id attribute - for example, see the bolded text:

{
"type": "TextBlock",
"text": "{panel:Fake Names}️",
"id": "custName",
"style": {
"text-align": "center",
"font-weight": "bold",
"font-size": "24px",
"margin": "100px"
}
}

2. Open the widget's script and add this:

widget.on('ready', function(w, args) {
  var custCount = w.queryResult.length;
  if (custCount > 1) {
    $("#custName").text("Aggregate data (" + custCount + " customers)") //insert your id in place of custName
  }
});

Here are the results when 1 customer is filtered to vs. many.

Community_Admin_0-1634631706847.png

 

Community_Admin_1-1634631706712.png

Additionally, if you want to, you can get rid of the carousel arrows like this in the BloX editor:

"showCarousel": true,
  "carouselAnimation": {
    "showButtons": false
  }

 

Version history
Last update:
‎10-19-2021 01:22 AM
Updated by:
Contributors
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Need additional support?:

Community Support Request