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?
0
Comments
what happens when running the code two times ?
do you CLOSE the recordref clearly ?
Fieldref := RecordRef.FIELD(1);
FieldRef.VALUE('ABC001');
Fieldref := RecordRef.FIELD(2);
FieldRef.VALUE('ABC market');
IF NOT RecordRef.INSERT THEN RecordRef.MODIFY;
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
it works....
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.