OnLookup - save value
Fisherman
Member Posts: 456
I'm really having trouble with something that seems like it would be easy.
I'm using OnLookup() in a table to allow the user to select a value, and I'm trying to store the result of that value through Validate.
When I step through the debugger, I see that the value was captured, and can even see the value in Rec, but once the validate trigger is finished, the table hasn't been updated.
Has anyone else seen this before? Is this a common problem that I'm just missing?
I'm using OnLookup() in a table to allow the user to select a value, and I'm trying to store the result of that value through Validate.
When I step through the debugger, I see that the value was captured, and can even see the value in Rec, but once the validate trigger is finished, the table hasn't been updated.
Has anyone else seen this before? Is this a common problem that I'm just missing?
0
Comments
-
are you using code or the properties of the field to lookup? If code can you post it?0
-
If you are using code - have you then tried using a MODIFY after setting the field value?0
-
MODIFY does not run the field validation, it writes the whole record to the database. To validate a field in code, you use:
TheRecordVariable.VALIDATE(TheField,Value);
My guess is that this is the OnLookup trigger of a form, and you'll need to add the VALIDATE into the field to make the OnValidate code run.0 -
Yes, I know that MODIFY does not trigger the Validation of a field.
- but if the changes has not been stored, it could be an idea to first validate the field and then afterwards do a modify ;-)0 -
Thanks, guys.
I was trying to raise a custom STRMENU dialog from the lookup function for the field, and save the integer result to that field.
Kind of like an OptionString, only I couldn't use an Option for this field because I'm trying to create a higher-level abstraction for generalization purposes, so I'm dynamically creating the OptionString and showing it in a STRMENU, and then storing the result.
I ended up solving it by moving the code into the Form. I just couldn't get it to modify the field value when the code was inside the validate trigger for that field.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 333 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 991 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
