RecordRef ChangeCompany FieldRef use to update field values
itinkiam
Member Posts: 37
I'm trying to update field values across all companies. Never to be accused of making something too simple, perhaps that's what I'm doing. I run this algorithm and only the record in the company that I'm on is changed. I've put a call to my function in each field that I want to run the update.
Oh. And I think this really should be simple because all of the fields that I'm updating are boolean.
What am I doing wrong? Help?
SetupChange(FieldNo : Integer;Value : Boolean)
IF locCompany.FINDSET THEN REPEAT
thisRec.CHANGECOMPANY(locCompany.Name);
IF locCompany.Name <> COMPANYNAME THEN BEGIN
thisRec.GET();
CLEAR(RecordRef);
RecordRef.OPEN(50007,FALSE,locCompany.Name);
FieldRef := RecordRef.FIELD(FieldNo);
FieldRef.VALUE(Value);
RecordRef.MODIFY;
END;
UNTIL locCompany.NEXT = 0;
Oh. And I think this really should be simple because all of the fields that I'm updating are boolean.
What am I doing wrong? Help?
SetupChange(FieldNo : Integer;Value : Boolean)
IF locCompany.FINDSET THEN REPEAT
thisRec.CHANGECOMPANY(locCompany.Name);
IF locCompany.Name <> COMPANYNAME THEN BEGIN
thisRec.GET();
CLEAR(RecordRef);
RecordRef.OPEN(50007,FALSE,locCompany.Name);
FieldRef := RecordRef.FIELD(FieldNo);
FieldRef.VALUE(Value);
RecordRef.MODIFY;
END;
UNTIL locCompany.NEXT = 0;
0
Comments
-
itinkiam wrote:I'm trying to update field values across all companies. Never to be accused of making something too simple, perhaps that's what I'm doing. I run this algorithm and only the record in the company that I'm on is changed. I've put a call to my function in each field that I want to run the update.
Oh. And I think this really should be simple because all of the fields that I'm updating are boolean.
What am I doing wrong? Help?
SetupChange(FieldNo : Integer;Value : Boolean)
IF locCompany.FINDSET THEN REPEAT
thisRec.CHANGECOMPANY(locCompany.Name);
IF locCompany.Name <> COMPANYNAME THEN BEGIN
thisRec.GET();
CLEAR(RecordRef);
RecordRef.OPEN(50007,FALSE,locCompany.Name);
FieldRef := RecordRef.FIELD(FieldNo);
FieldRef.VALUE(Value);
RecordRef.MODIFY;
END;
UNTIL locCompany.NEXT = 0;
Hi
you must do
RecordRef.GET;
//processing
or
IF RecordRef.FINDSET THEN
REPEAT
//processing
UNTIL RecordRef.NEXT = 0;
Bye
MatteoReno Sistemi Navision Developer0 -
\:D/ THANK YOU!!! Here's the new code that worked...
IF locCompany.FINDSET THEN REPEAT
thisRec.CHANGECOMPANY(locCompany.Name);
IF locCompany.Name <> COMPANYNAME THEN BEGIN
thisRec.GET();
CLEAR(RecordRef);
RecordRef.OPEN(50007,FALSE,locCompany.Name);
RecordRef.FINDFIRST;
FieldRef := RecordRef.FIELD(FieldNo);
FieldRef.VALUE(Value);
RecordRef.MODIFY;
END;
UNTIL locCompany.NEXT = 0;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
- 328 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