Dashboard/Indicator and Arcade

205
4
Jump to solution
01-19-2022 09:13 AM
AnnettePoole1
Occasional Contributor

Background - using Dashboard and the indicator widget.  When the widget has no data, the return is no data. Instead I would like to return a zero, "0".  Now with Arcade ability, I thought I might be able to do this, but need your help.  Here is what I have tried.

Using the below, I get "Unexpected Token If".  I wonder if this is because "If" is not listed in the function list.

return {
//textColor:'',
//backgroundColor:'',
topText: If ($datapoint["sum_number_of_citations_issued"] > '0'){
return '$datapoint["sum_number_of_citations_issued"]';
} else if ($datapoint["sum_number_of_citations_issued"] < '0'){
return '0';
}
topTextColor: '#ffffff',
topTextOutlineColor: '',
topTextMaxSize: 'medium',
//middleText: '',
//middleTextColor: '',
//middleTextOutlineColor: '',
//middleTextMaxSize: 'large',
//bottomText: '',
//bottomTextColor: '',
//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
//iconName:'',
//iconAlign:'left',
//iconColor:'',
//iconOutlineColor:'',
//noValue:false,
//attributes: {
//attribute1: '',
// attribute2: ''
// }
}

I also tried:

IIf($datapoint["sum_number_of_citations_issued"] < 1, '0')

and the error I get is Syntax Error: Function signature does not match; IIF

Thank you,

Annette

 

 

0 Kudos
1 Solution

Accepted Solutions
JayantaPoddar
MVP Esteemed Contributor

Just try

 

 

$datapoint["sum_number_of_citations_issued"]

 

 

For No Data value, just change the Default Label to 0.

JayantaPoddar_0-1642627693579.png

 

JayantaPoddar_1-1642627751259.png

 

 

 



Think Location

View solution in original post

4 Replies
JayantaPoddar
MVP Esteemed Contributor

Check if the following expression works.

 

var s = $datapoint["sum_number_of_citations_issued"]
IIF(s < 1, 0, s)

 



Think Location
0 Kudos
AnnettePoole1
Occasional Contributor

Hello, 

States unexpected token var.  Am I putting it in the wrong place. This is the indicator widget on dashboard.  I then removed it and placed the two lines at the top, but I wasn't sure what to put after topText: .

Thank you for your help.
return {
//textColor:'',
//backgroundColor:'',
topText: var s = $datapoint["sum_number_of_citations_issued"]
IIF(s < 1, 0, s)
topTextColor: '#ffffff',
topTextOutlineColor: '',
topTextMaxSize: 'medium',
//middleText: '',
//middleTextColor: '',
//middleTextOutlineColor: '',
//middleTextMaxSize: 'large',
//bottomText: '',
//bottomTextColor: '',
//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
//iconName:'',
//iconAlign:'left',
//iconColor:'',
//iconOutlineColor:'',
//noValue:false,
//attributes: {
// attribute1: '',
// attribute2: ''
// }
}

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Just try

 

 

$datapoint["sum_number_of_citations_issued"]

 

 

For No Data value, just change the Default Label to 0.

JayantaPoddar_0-1642627693579.png

 

JayantaPoddar_1-1642627751259.png

 

 

 



Think Location
AnnettePoole1
Occasional Contributor

Thank you so much! Is this a new feature with 10.9.1 or have I been blind! So easy. I knew it had to be. Thank you, thank you!

0 Kudos