Hi !
I need to explaine a problem that occurred on my Company Windows 98 workstations but not in Windows 2000 ones.
I created 2 new fields in Sales Order Lines Table, that are:
Sales person, Commissions %
I declared, in Sales Order Lines 1 more function, that is:
get_Commission: this is the implementation:
get_Commission(){
RecCommissions.SETRANGE( CodSalesPerson , Rec.Salesperson); //it's a 5xxxx table
IF RecCommissions.FIND( '-' ) THEN
Rec.Commission % := RecCommissions.Percentage
ELSE
MESSAGE( ' NOT FOUND COMMISSION!');
}
Then added this line to trigger:
Salesperson - On Validate()----
get_Commission( Rec.Salesperson );
My wishes are:
In any case Validation it's ok and the record will be modified; in some cases I will have a Message but nothing else.
Ok: On Windows 98 , ( Not in 2K ) workstations things doesn't go like this.
The record isn't modified in case of MESSAGE.If I comment MESSAGE istruction everything goes well and the modification .
Anybody knows why ?
0
Comments
Ciao
Marco
(Bad) English Version:
You must use ERROR and not MESSAGE. I have some doubt abut the correctness of your procedure. I cannot understand why you must read the first record of the commission table. If you have N records of commissions?
Bye
Marco
Microsoft Certified Trainer
Cronus.it
Ciao!
Allora ti do 3 risposte:
1) Il mio scopo non è generare un errore ma un warning ( cioè non bloccare la modifica)
2) La mia tabella commissioni contiene solo un record valido per agente;
( certo applico anche un' altro paio di setrange ma questo richiede che ti spieghi come è fatta la tabella commissioni e non credo che sia importante)
3) forse non l'ho detto:
eseguendo la validazione da tabella viene generato il messaggio ma la modifica va a buon fine.
Un'altra domanda xchè su win2000 funziona e su win98 no?
english:
Hi !
3 Replies:
1) My goal is not to cause an ERROR just give a warning ( not to stop modifying);
2) My Table Commission has only one valid record for each salesperson.
( yes, I apply another couple of SETRANGE but so I need to explain to you the definition of Commission table and this is not important ).
3)Maybe I didnt' say this: while editing directly in the table, message is shown and modify is done.
Another question why on Windows 2000 works and in Windows98 doesn't?
Non usare mai MESSAGE nei trigger e tantomeno nelle codeunit di registrazione perché il comportamento del parser diventa imprevedibile. Sul perché ci siano differenze tra i due sistemi non te lo so dire ma è un'ulteriore prova che l'uso del MESSAGE non è corretto.
Ciao
Marco
The only way is to create a form for the warning and open it, exactly as the warning for customers on the orders or the warning for quantity on the order lines.
Do not use MESSAGE in triggers and never in the posting's codeunits because the parser's behaviuor is not predictable. About the difference between the two operating systems I don't know anything but it's a confirmation that is better not to use MESSAGE.
Bye,
Marco
Microsoft Certified Trainer
Cronus.it
Così il giro funziona
Ti ringrazio ancora tanto,
Matteo
Thank you ! I followed your advice: deleted MESSAGE calls and used a FORM that I set with a public function.This works well.
Thanks a lot,
Matteo.
And, in some older clients there is problem that message in trigger undo all changes in record... (BUG)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.