Image doesn't load at 'else'

Hello everyone,

I’ve got this method:

if (recordstatus != null)
{
   if( recordstatus == "1")
   { 
   return '<html><img src="media:///bullet_ball_green.png"></html>;' 
   } 
   if( recordstatus == "2")
   { 
   return '<html><img src="media:///bullet_ball_blue.png"></html>;' 
   }
   if( recordstatus == "3")
   { 
   return '<html><img src="media:///bullet_ball_red.png"></html>;' 
   }
}
else
{ 
return '<html><img src="media:///bullet_ball_blue.png"></html>;'
}

Everything works, except the ‘else’ function. I guess I forgot something, but what :?:

I think you have to switch the ; and ’ at the end of the return statement, but the strange thing is that in the other cases, you have also done it this way…

Also, if recordstatus is not null, you go into the “If then” part, where you only capture situations 1,2 and 3. What happens if recordstatus is empty (“”) or 4, for example?

Paul

Hi Paul,

Thanks for the tips, but Else just didn’t work at the end of the method, so I solved it by

if (recordstatus == null)
   {
   return '<html><img src="media:///bullet_ball_blue.png"></html>'
   }
else
{
   if( recordstatus == "1")
   { 
   return '<html><img src="media:///bullet_ball_green.png"></html>'; 
   } 
   if( recordstatus == "2")
   { 
   return '<html><img src="media:///bullet_ball_blue.png"></html>'; 
   }
   if( recordstatus == "3")
   { 
   return '<html><img src="media:///bullet_ball_yellow.png"></html>' 
   }
}

Bit strange, but it works this way..
:?

Seems impossible to me, your field recordstatus must have had the value 1 all the time.