Change cell color if stock-level is 0

Hello!

We are a couple of students who are struggling with a problem in Axapta 4.0.

We want a cell to change color if the stock level for that item is 0. How can we achieve this? I’ve googled around and managed to change color on a row (by overriding displayoption() for that table), but what we need is to change the color ONLY when stock-level is 0. I guess we need some kind of if-statement?

Please help us with this, it’s urgent! =)

Hi,

Instead of using display option() method, use active method.

Just change the auto declaration of the required cell to “Yes”…

lets say it is field1(name of the field in design)… in table1…

public int active()
{
int ret;
;

if (table1.stock == 0)
{
field1.colorScheme(FormColorScheme::RGB);
field1.backgroundColor(Winapi::rgb2int(255,0,0));
}
else
{
field1.colorScheme(FormColorScheme::RGB);
field1.backgroundColor(Winapi::rgb2int(255,255,255));
}

ret = super();

return ret;
}

This might help you…

Awesome, thanks