coloring of fields

I want to color the field based on EDT Array element of type real

can any one help me out please

its very urgent

thanks

Depending on what you actually need, displayOption() may be the way to go. Check out Coloring Grids in DAX.

If it’s not suitable, tell us more about your requirements.

The example you sent i have already did this

my problem is

go to project management module → All timesheets_> edit it-> you get different hours or day wise , i want to color those fields in the particular that is based on condition i.e if that particular day is more than 8 hours then it will be as it is otherwise it will display red color to that field if less than 8 hours

displayOption() can use a condition and you can choose affected columns, but you have only one instance of FormRowDisplayOption, so you can’t configure fields individually.

If you really need to color individual cells, I don’t think you can do that in a grid, but it should be possible in a table (FormTableControl).

Sir

for particular field i can able to color it but the issue exactly is that the hours field defined by the EDT containg 7 array element and when i am using its control from the grid in the form level the control is not taking in the development

but for different fields that does not contain the array element defined by EDT I can define the control of the grid

please follow the above flow as i have defined and check the EDT for that field you will get to know what exaclty the issue

thanks

Rahul

Can you explain what “when i am using its control from the grid in the form level the control is not taking in the development” actually means?

I tried to use displayOption() for array fields and it worked as usual. I thought that your problem was in what I described in my last answer, but now I have no idea what you’re saying.

public void displayOption(Common _record, FormRowDisplayOption _options)

{

real value = 8.00;

TSTimesheetLineWeek _TSTimesheetLineWeek;

TSTimesheetLine _TSTimesheetLine;

TSTimesheetTrans _TSTimesheetTrans;

;

if(_record.TableId == tableNum(TSTimesheetLineWeek))

{

_TSTimesheetLineWeek = _record;

}

select sum(Hours) from TSTimesheetTrans where TSTimesheetTrans.TSTimesheetLineWeek == TSTimesheetLineWeek.RecId

&& TSTimesheetTrans.ProjTransDate == TSTimesheetLineWeek.ProjTransDate;

if(TSTimesheetTrans.Hours < value)

{

_options.textColor(WINAPI::RGB2int(255,0,0));

_options.affectedElementsByControl((TSTimesheetLineWeek_hours[1]);

}

super(_record, _options);

}

that what i have used by it is not getting effected to that grid

This line:

_options.affectedElementsByControl((TSTimesheetLineWeek_hours[1]);

has two compilation errors:

  • It has one extra opening parenthesis
  • The method accepts a control ID (int), not a control itself.

If your code doesn’t compile, it makes no sense to expect it work.

Change your code either:

  • to use affectedElementsByField() and pass field ID
  • to use affectedElementsByControl(), but get control’s ID by calling id() method. There seems to be a problem with the brackets in control’s name, therefore rename it to TSTimesheetLineWeek_hours1, for instance. Don’t forget to set AutoDeclaration to Yes.

Sir,

its not getting renamed and i tried it before

so please tell me any other way

thanks

Rahul

The errors i removed

and i tried to change the control too but i can’t able to change as it start throughing error

Help me out if it possible

if anybody has tried por if not possible please let me know

It’s not possible unless you tell us what’s your current problem.

You said that you get some error when trying to change the control. What’s the error? And isn’t it easier to use affectedElementsByField()? Example: _options.affectedElementsByField(fieldId2ext(fieldNum(MyTable, MyArrayField), 1));

the field is selected if text need to be colored

but i need the whole box should be coloured , since its an array element might be its not possible to color the field instead of that i colored the text i mean the number i stored in it after calculation

thanks