quantity validate trigger not firing when asked

wic
Member Posts: 96
MBS-Navision 4.0
Table 37.
New field MyField.
Onvalidate of that field, I write:
validate(quantity,myfield * 33)
the OnValidate trigger of field QUANTITY is not fired. :shock:
The value in quanitty is correct. (but all prices, ... aren't)
What this:ü@*# :evil: ](*,)
Table 37.
New field MyField.
Onvalidate of that field, I write:
validate(quantity,myfield * 33)
the OnValidate trigger of field QUANTITY is not fired. :shock:
The value in quanitty is correct. (but all prices, ... aren't)
What this:ü@*# :evil: ](*,)
#### Only one can survive ######
0
Answers
-
I think you meant to code like below: -
EVALUATE(quantity,myfield * 33);
Regards,
Peter Ng0 -
no nope. I want to run the OnValidate trigger of the field quantity.
This is trivial code that suddenly doesn't work anymore?!? Or something special happens to the quantity field of T37.
The myField is a decimal.
I want to validate the entered value (in myField) in the field Quantity with a sepcific mathematical formula#### Only one can survive ######0 -
wic wrote:Onvalidate of that field, I write:
validate(quantity,myfield * 33)
You mentioned you wrote the command in the OnValidate Field. The validate command is to call OnValidate, which mean your command calling itself.
To trigger this onvalidate, it should like below: -Rec.validate(quantity,myfield * 33)
It should be calling outside the trigger, and not inside.Regards,
Peter Ng0 -
I am sure you have but you did not mention it:
Have you used the debugger to check what happens?0 -
Have you tried creating a local decimal variable, and doing the calculation on it, like this:
MyDecimal := MyField * 33; VALIDATE(Quantity,MyDecimal);
0 -
I belive the Quantity- OnValidate trigger is already fired. Just check it using debugger or simply put a message in it. If the price, etc doesn't change, I think it's because another reason, try to use debugger to find it out.Be fast, be straight, be quiet0
-
thanx all. :-k
The debugger goes through OnValidate of quantity but doesn't execute the same code as if I enter the qty directly in that field.
Example:
Table 37
MyField (decimal)
OnValidate()
// WIC adapt qty
validate(quantity,MyField * .03)
Quantity
OnValidate()
"all standard code"
On the sales order line:
If I enter 100 in quantity: price is 200 (unit price = 2) (OK)
MyField Quantity Price
100 200
if I enter 100 in MyField quantity is 3, price is still 200 should be 6 (NOK)
MyField Quantity Price
100 3 200
if I go on quantity and validate the field, price is updated to 6 (OK)!!
MyField Quantity Price
100 3 6
What's wrong? #-o#### Only one can survive ######0 -
I've performed a small test and noticed the same thing.
In Table 37, some functions repspond to the field you are in. This is triggerd by the CurrFieldNo
You should investigate what functions are called and somewhere add your field to some statement.
You can use code coverage or the debugger to investigate what happens.0 -
EUREKA!! =D> I found the problem.!!
The function UpdateUnitPrice analyze the callingField with the currentField.
The currentField in my case is MyField and NOT quantity! so he doesn't execute the unit price calc.
What a complicated case for just a price update.
:shock:
That's all folk's. Thanx for your help.#### Only one can survive ######0 -
Congratulations.
Yes, Navision is not as simple as it once was anymore
Remember the [SOLVED] thing in the subject.0 -
I would make a brakpoint at UpdateUnitPrice and
> :shock:0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions