RecRef and FieldRef

Matt_Keyes
Member Posts: 23
I am having zero luck updating a new record from a recref via a field ref.
Like so:
A record is indeed inserted but none of the values from the fieldref validate calls are set. Any advice?
Like so:
UpdateBuffer.SETRANGE("Primary Key",TRUE); IF NOT UpdateBuffer.FINDFIRST THEN ERROR(STRSUBSTNO('No primary keys found for table %1.',UpdateBuffer."Table No.")); RecRef.OPEN(UpdateBuffer."Table No.",FALSE,COMPANYNAME); RecRef.INIT; REPEAT FieldRef := RecRef.FIELD(UpdateBuffer."Field No."); EVALUATE("Var",UpdateBuffer."Field Value"); FieldRef.VALIDATE("Var"); UNTIL UpdateBuffer.NEXT = 0; UpdateBuffer.SETRANGE("Primary Key",FALSE); IF UpdateBuffer.FINDFIRST THEN REPEAT //now get each field ref and set the value accordingly FieldRef := RecRef.FIELD(UpdateBuffer."Field No."); EVALUATE("Var",UpdateBuffer."Field Value"); FieldRef.VALIDATE("Var"); UNTIL UpdateBuffer.NEXT = 0; //call a modify here on the rec ref RecRef.INSERT(TRUE); RecRef.CLOSE;
A record is indeed inserted but none of the values from the fieldref validate calls are set. Any advice?
0
Comments
-
Hi Matt,
Not sure what you are trying to acheive with the code. I'm guessing the you are hoping to update a number of records but "recref" variable is on the initial record. There is not MODIFY and only one INSERT. On the face of it, I think you are over complicating it. A second UpdateBuffer would be more normal.
Can you explain what you want to acheive0
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