images in list view

I hope someone can point me in the right direction. I have a form in list view and I’d like to display an image on each row indicating some sort of status. So some records might have a green image for good status, some might have red for bad etc.

I’ve looked through the documentation and I must be blind cos I just can’t figure out how to use images in Servoy in order to achieve what I want.

Could someone please let me know where to start?

Many thanks

Sham

Hi Sham

Welcome to the Forum.

Several ways to do this but following should get you started.

Use a graphics program to create squares/rectangles with a coloured background. In Layout mode use Elements / Place Image / Import File to store these images in Servoy. Create a calculated field in your database table - see code below - then you can use this field on your layouts just like any other.

if (current_status == 'Current')
	{ return 'media:///100x100_Green.gif' ; }

if (current_status == 'Lapsed')
	{  return 'media:///100x100_Pink.gif'; }

if (current_status == 'Overdue')
	{  return 'media:///100x100_Orange.gif'; }

It would have been neater to use ‘Switch’ rather than lots of If’s - but its old code and it works :)

Graham Greensall
Worxinfo Ltd

Thanks Graham. That’s exactly what I was looking for.

Cheers

Sham