How would I convert values (0,1) with yes/no in a list?
This is what I tried but not right
Data Table:
Solved! Go to Solution.
You should use the When function. Is the field numeric or a string?
//if it's a number
var over = When($datapoint['IsOverriden'] == 0, 'No',
$datapoint['IsOverriden'] == 1, 'Yes',
'');
//if it's a string
var over = When($datapoint['IsOverriden'] == '0', 'No',
$datapoint['IsOverriden'] == '1', 'Yes',
'');
You should use the When function. Is the field numeric or a string?
//if it's a number
var over = When($datapoint['IsOverriden'] == 0, 'No',
$datapoint['IsOverriden'] == 1, 'Yes',
'');
//if it's a string
var over = When($datapoint['IsOverriden'] == '0', 'No',
$datapoint['IsOverriden'] == '1', 'Yes',
'');
@KenBuja Thank you!
@KenBuja If I wanted to hide the Override line if the value is 0 would that be done through an if statement? Or can that still be done using the when statement?
Showing only records that have 1/yes
How are you constructing the text block?
@KenBuja I removed the == 0, 'No', line thinking the list would remove/hide the 0 values, but it still read Score override: (because that is part of the text block)
(didn't think it would be that easy but gave it a shot)
Doing this:
and then:
{expression/icon}
{AssesmentName}
Created on {expression/create}
Created by {Creator}
Score override: {expression/over}
Instead of putting "Score override: " in the text block, add that in the expression only if the value is "Yes"
If ($datapoint['IsOverriden'] == 1) return 'Score override: Yes';
Great, thank you!
@KenBuja I'm new to arcade so I don't think I am doing something right. When I remove the text block that line is deleted (even values with 1/yes). Does the return call look in the right spot? See anything that I am doing wrong?
I'm sorry, I was incorrect. That should be
If ($datapoint['IsOverriden'] == 1) var over = 'Score override: Yes';
Keep 'over' in the attributes and {expression/over} in the template