trying to use the include function, but I get zero results

239
2
05-16-2023 12:43 PM
Labels (1)
jasongraham
New Contributor III

In the dashborad, one panel(p1)  controls another panel(P2)

P1 has a list of numbers ( 9-18)  when a number is selected it will display that number along with other information.  That works fine

On the P1 list is also an option for 'all'  I want to display 'all' when that is selected but it defaults to one of the numbers on the list.  I have tried several variations in Arcade, this seems logical but it does not work. Am I using 'include' wrong

 

 

var dt_tmstp = $datapoint.WeekStartDate
var dt = (Month(dt_tmstp)+1) + '-' + Day(dt_tmstp) + '-' + Year(dt_tmstp)
var L =[9,10,11,12,13,14,15,16,17,18]
var x = ($datapoint["BiWeek"])

if Includes(L, x){
return {
    textColor:'black',
    backgroundColor:'#9ab9b5',
    middleText: $datapoint["BiWeek"],
    middleTextColor: '',
    middleTextOutlineColor: '',
    middleTextMaxSize: 'large',
    bottomText: 'biweek period start: ' + dt,
 }
}
 else{
    return {
        textColor:'black',
        backgroundColor:'#9ab9b5',
        middleText:["All"],
        middleTextColor: '',
        middleTextOutlineColor: '',
        middleTextMaxSize: 'large',
      } 
  }

 

0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor

Try these two changes:

Line 6

if (Includes(L, x)){

Line 21

        middleText: "All",
jasongraham
New Contributor III

Thanks for that, it does return the approriate number, but not the 'all', it defaults to another number

0 Kudos