Copy link to clipboard
Copied
Hi, I have a search-results page that returns a number of fields as 1 or 0 (information collected from tick-boxes in my original submission form).
I have added a dynamic field in my results form to display these results, but they (obviously) come back as 1 or 0. How do I get this to render as "Yes" or "No"?
If you are using PHP:
if ($fieldname1==1){
$fieldname1='Yes';
} else {
$fieldname1='No';}
echo $fieldname1;
Copy link to clipboard
Copied
If you are using PHP:
if ($fieldname1==1){
$fieldname1='Yes';
} else {
$fieldname1='No';}
echo $fieldname1;
Copy link to clipboard
Copied
I usually do things like that with a ternary operator -
($fieldname==0)?$fieldname = "No":$fieldname = "Yes";
Copy link to clipboard
Copied
Or, of course, if you want to leave the data as 0 and 1, then this -
echo ($fieldname==0)?"No":"Yes";
Find more inspiration, events, and resources on the new Adobe Community
Explore Now