cancel
Showing results for 
Search instead for 
Did you mean: 

Blox - Display 0 instead of No Results

mirzay
8 - Cloud Apps
8 - Cloud Apps

In my Blox Code, if the "Panel" value is not returned, the display shows No Results. Is there anyway to display a 0 instead?

Blox Code is as below:

{
"style": {
"verticalAlignment": "center"
},
"script": "",
"title": "",
"showCarousel": true,
"carouselAnimation": {
"showButtons": false
},
"body": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"id": "",
"class": "",
"horizontalAlignment": "center",
"text": "space",
"style": {
"color": "#ffffff",
"font-size": "vw"
}
},
{
"type": "TextBlock",
"id": "",
"class": "",
"horizontalAlignment": "center",
"weight": "normal",
"text": "To Do's Completed - Last 30 days",
"style": {
"color": "#5e6574",
"font-size": "1vw"
}
},
{
"type": "TextBlock",
"id": "",
"class": "",
"horizontalAlignment": "center",
"text": "{panel:Total}",
"weight": "normal",
"style": {
"color": "#e2ac55",
"font-size": "2.5vw"
}
},
{
"type": "TextBlock",
"id": "",
"class": "",
"horizontalAlignment": "center",
"text": "<span class='blox-sparkline' type='line' line-color='#117899' width='200' height='50' line-width='3' fill-color='#B2D4DF' point-color:'#117899'>{spark:Total Spark}</span>"
},
{
"type": "TextBlock",
"id": "",
"class": "",
"horizontalAlignment": "center",
"text": "space",
"style": {
"color": "#ffffff",
"font-size": "vw"
}
}
]
}
],
"actions": []
}

 

I have a Widget script that works good with Indicators but does not affect the Blox results. Widget Script Below:
widget.on('render', function (w, q) {
if (isNaN(w.queryResult.value.data) === true)
{
w.queryResult.value.data = 0;
w.queryResult.value.text = "0";
}

if(w.queryResult.secondary != null && isNaN(w.queryResult.secondary.data) === true)
{
w.queryResult.secondary.data = 0;
w.queryResult.secondary.text = "0";
}
})

1 REPLY 1

Wojtek
9 - Travel Pro
9 - Travel Pro

HI

Try handling nulls in formula for 'Total' using IF or CASE. It also works for us to add 0 in formula to fix issues with NULLs.

Wojtek