Skip to main content
Inspiring
September 22, 2011
Answered

Convert 'Dynamic Text' with "1/0" to "Yes/No"

  • September 22, 2011
  • 3 replies
  • 719 views

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"?

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer Rob Hecker2

If you are using PHP:

if ($fieldname1==1){

$fieldname1='Yes';

} else {

$fieldname1='No';}

echo $fieldname1;

3 replies

Rob Hecker2
Rob Hecker2Correct answer
Legend
September 22, 2011

If you are using PHP:

if ($fieldname1==1){

$fieldname1='Yes';

} else {

$fieldname1='No';}

echo $fieldname1;

MurraySummers
Inspiring
September 25, 2011

I usually do things like that with a ternary operator -

($fieldname==0)?$fieldname = "No":$fieldname = "Yes";

MurraySummers
Inspiring
September 25, 2011

Or, of course, if you want to leave the data as 0 and 1, then this -

echo ($fieldname==0)?"No":"Yes";