RecordRef and MODIFY

doktor
Member Posts: 28
Hi,
I have this problem. I work with recordref and I change any fileds of record. But when I modify this record, the fields which I modify are OK, but the fields which were filled before execute code and I don't modify theirs, they are blank.
CODE :
RecordRef.OPEN(18);
Fieldref := RecordRef.FIELD(1);
FieldRef.VALUE('ABC001');
Fieldref := RecordRef.FIELD(2);
FieldRef.VALUE('ABC market');
IF NOT RecordRef.INSERT THEN RecordRef.MODIFY;
The problem is this, when I open the Recordref all his fields are blank. How can I set filter for RecordRef and then I fill fields which I want and the fileds which I don't change stay same like before execute the code?
I have this problem. I work with recordref and I change any fileds of record. But when I modify this record, the fields which I modify are OK, but the fields which were filled before execute code and I don't modify theirs, they are blank.
CODE :
RecordRef.OPEN(18);
Fieldref := RecordRef.FIELD(1);
FieldRef.VALUE('ABC001');
Fieldref := RecordRef.FIELD(2);
FieldRef.VALUE('ABC market');
IF NOT RecordRef.INSERT THEN RecordRef.MODIFY;
The problem is this, when I open the Recordref all his fields are blank. How can I set filter for RecordRef and then I fill fields which I want and the fileds which I don't change stay same like before execute the code?
0
Comments
-
this sounds that navision inserts the recordref instead of modifying it.
what happens when running the code two times ?
do you CLOSE the recordref clearly ?0 -
You need to GET or FIND the record you want to modify before you set the values of the fields.0
-
Yes, but how? I work with RecordRef and each Record has different count of keys. I don't know how I have to set filter for record0
-
doktor wrote:RecordRef.OPEN(18 );
Fieldref := RecordRef.FIELD(1);
FieldRef.VALUE('ABC001');
Fieldref := RecordRef.FIELD(2);
FieldRef.VALUE('ABC market');
IF NOT RecordRef.INSERT THEN RecordRef.MODIFY;
Fieldref := RecordRef.FIELD(1);
FieldRef.VALUE('ABC001');
Fieldref := RecordRef.FIELD(2);
FieldRef.VALUE('ABC market');
IF NOT RecordRef.INSERT THEN RecordRef.MODIFY;Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
sorry but this work exactly how my code. When I try this i modify fields which I change, but which I don't change and they don't blank after modify they are blank. I think it is abou how I filter record which I want to modify.0
-
Try this
RecRef.OPEN(18); FldRef := RecRef.FIELD(1); // No. FldRef.VALUE := '10000'; IF RecRef.FIND('=') THEN BEGIN FldRef := RecRef.FIELD(2); // Name FldRef.VALUE := 'ABC Market'; RecRef.MODIFY; END;
0 -
Thanks,
it works....0 -
Hi,
I have a very similar problem.
I want to modify a table with a recordref and I not able to achieve it. While i am debugging I can see that my code apparently works and the new values are changed but, at the end of the execution, the table remains without changes.
VARIABLES:
boolInsert boolean
locrecimport record table Import
LineRecordRef recordref
LifieldRef fieldref
CODE
boolInsert := FALSE;
locrecImport.GET(codeImport);
LineRecordRef.OPEN(DATABASE::Import,FALSE);
LinefieldRef := LineRecordRef.FIELD(locrecImport.FIELDNO("No.")); //No. is th PK of the Import table
LinefieldRef.VALUE(codeImport);
IF LineRecordRef.FIND('=') THEN BEGIN
recField.RESET;
recField.SETRANGE(TableNo,DATABASE::Importaciones);
recField.SETFILTER(FieldName, '%1','EDI Problem Flag*');
IF recField.FINDSET(FALSE, FALSE) THEN BEGIN
REPEAT
IF FORMAT(LineRecordRef.FIELD(recField."No.").VALUE) = '' THEN BEGIN
boolInsert := TRUE;
LinefieldRef := LineRecordRef.FIELD(recField."No.");
LinefieldRef.VALUE(textProblemFlag);
LineRecordRef.MODIFY(TRUE);
END;
UNTIL ((boolInsert) OR (recField.NEXT()=0));
END;
LineRecordRef.CLOSE();
I am not very experimented with recordref but I have tested every thing I know.
Can anybody help me?
Thank you and my best regards.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