0

I'm using freeboard. I cloud platform where I'm adding my API and getting results in charts. I have an API which gives the values 1 and 0 but I need to show granted and denied instead of 1 and 0. There is an option to write is in the data sources like below

return datasources["rfid access"] + 3 // output coming 4 

like that i need to show granted if rfid access result is 1 and denied for 0

cweiske
  • 30,033
  • 14
  • 133
  • 194
Swapna
  • 403
  • 3
  • 6
  • 24

1 Answers1

2

You can use simple logic like this:

if(APIval === 0){
    return 'denied';
}
else{
    return 'granted';
}

Or you can use a conscise version of it:

return APIval===0 ? 'denied' : 'granted';