Reputation: 19
So i'm trying to colorize form lines with different colors. if i check current.PrimaryTransportation checkbox in one line and all i get is one big yellow grid
the code i'm using looks like this:
public void displayOption(Common _record, FormRowDisplayOption _options)
{
SIS_ResourcesTmp buffer = _record;
SIS_ResourceSum current = SIS_ResourceSum_DS.cursor();
#define.grey(12895428)
#define.white(16448250)
#define.yellow(3927039)
;
_options.backColor(#grey);
if (!current.VendorPrice && !current.UnitConvertRate) {
if (!current.UnitConvertToTons && !current.DistanceVendorToObject && current.PrimaryTransportation) {
_options.backColor(#yellow);
}
} else {
_options.backColor(#white);
}
SIS_ResourcesTmp_ds.refresh();
}
Upvotes: 2
Views: 312
Reputation:
This depends on your scenario but I think you need one more else conditon for the nested if statement. Or I would rather try to eliminate the nested if like this:
if (!current.VendPrice &&
!current.UnitConvertRate &&
!current.UnitConvertToTons &&
current.PrimaryTransportation)
{
_options.backColor(#yellow);
}
else
{
_options.backColor(#white);
}
Upvotes: 0
Reputation: 35398
Use the parameter _record
to check whether to set the color for the current row to yellow or not.
Upvotes: 1