how to write the code for change sales line ?

Dear:

Hi,i’m novice of navision,i want to automaticlly change the color(red) of sales line while it fulfil some condition,for example,if “quantity shipped”<>“quantity”,then “document no.” will be change to red.i have added below code on onformat of document no:

IF salesline.“Quantity Shipped”<>salesline.Quantity THEN
CurrForm.“Document No.”.UPDATEFORECOLOR:=red;

but why all lines have been changed(red)?

does anybody know this?thanks!

Best regards

You have to do the else statement.

eg.

ELSE

CurrForm.“Document No.”.UPDATEFORECOLOR := BLACK;

Where did you put your code? To change color to a field in a specific line you should use the field OnFormat trigger… and, of course, set the ELSE condition, as Munib already said.

Hi,munib: Thank for your answer,but I add ELSE statement, all lines still changed red(contain quantity received=quantity of lines),that is not what I hope.

Hi,Anna: My code put in Onformat trigger of **Document No.**field,whole code below:IF salesline.“Quantity Shipped”<>salesline.Quantity THEN CurrForm.“Document No.”.UPDATEFORECOLOR:=255****ELSE **CurrForm.“Document No.”.UPDATEFORECOLOR:=32768;**Byt result is still not what I want,all line changed red.Then,where is my mistake?Best regards Billwan

sorry, mi make a mistake,as above,put in the code to onformat,result is all line changed green.why?

thanks for all helper.

Best regards

Bill