Highlighting preferred customers

Good day.

I need to highlight in the form of sales orders (SalesTable) some customers who are registered in a particular group.

Below is the code I’m writing, however, was unable to put the parameter group of customers I need.

public void displayOption(Common _record, FormRowDisplayOption _options)

{

#define.DarkGray(80, 80, 80)

#define.LightGray(200, 200, 200)

#define.White(255, 255, 255)

CustTable CustTable;

;

CustTable = _record;

super(_record, _options);

if (CustTable::find(SalesTable.CustAccount).AccountNum)

{

_options.backColor(WinAPI::RGB2int(#DarkGray));

_options.textColor(WinAPI::RGB2int(#White));

}

else

{

if (SalesTable.CustAccount)

{

_options.backColor(WinAPI::RGB2int(#LightGray));

}

}

}

In the customer master table CustTable), I could already stand out as code below.

public void displayOption(Common _record, FormRowDisplayOption _options)

{

#define.DarkGray(80, 80, 80)

#define.Red (255,0,0)

#define.LightGray(200, 200, 200)

#define.White(255, 255, 255)

CustTable localCustTable;

localCustTable = _record.data();

if (localCustTable.CustGroup == ‘CLI_PR’)

{

_options.backColor(WinAPI::RGB2int(#Red));

_options.textColor(WinAPI::RGB2int(#White));

}

else

{

_options.backColor(WinAPI::RGB2int(#LightGray));

}

super(_record, _options);

}

Can anyone help me?

Hugs.

You get _record parameter, assign it to custTable variable and never use it. Instead of that, you refer to salesTable.CustAccount. That’s likely the problem.

Hi

try this

public void displayOption(Common _record, FormRowDisplayOption _options)

{

#define.DarkGray(80, 80, 80)

#define.LightGray(200, 200, 200)

#define.White(255, 255, 255)

SalesTable SalesTable;

CustTable CustTable1;

;

CustTable1 = _record;

if (CustTable::find(CustTable1.AccountNum))

{

_options.backColor(WinAPI::RGB2int(#DarkGray));

_options.textColor(WinAPI::RGB2int(#White));

}

else

{

if (SalesTable.CustAccount)

{

_options.backColor(WinAPI::RGB2int(#LightGray));

}

}

super(_record, _options);

}

But how can I get in CustTable these records defined as “preferred” and highlight them in SalesTable?

If I do not comment on SalesTable, it does not compile the method, and commenting on, the following error appears:

" The field whose ID is '0 ‘does not exist in table’ SalesTable '."

You asked: "how can I get in CustTable these records defined as “preferred”? But how do you define “preferred”?

I guess that you added the method on a SalesTable data source (but you would have to confirm that), therefore _record contains a SalesTable record and not CustTable. If it’s so, the assignment custTable = _record is wrong - you should use SalesTable salesTable = _record.

Martin’s right!

Realized the change as you recommended, I added the parameter I need, however, still did not work.

Here’s how the code looks:

public void displayOption(Common _record, FormRowDisplayOption _options)

{

#define.DarkGray(80, 80, 80)

#define.Red (255,0,0)

#define.LightGray(200, 200, 200)

#define.White(255, 255, 255)

CustTable CustTable;

;

SalesTable = _record;

super(_record, _options);

if (CustTable::find(SalesTable.CustAccount).AccountNum && CustTable.CustGroup == ‘CLI_PR’)

{

_options.backColor(WinAPI::RGB2int(#Red));

_options.textColor(WinAPI::RGB2int(#White));

}

else

{

if (SalesTable.CustAccount)

{

_options.backColor(WinAPI::RGB2int(#LightGray));

}

}

}