Why do you have a FOR-loop if you only need it to hand the specific field?
Also if you create a new record, then the remaining fields will always have the initial value. So what did you expect the values of the other fields to be? NAV doesn’t support NULL as such.
Thanks for your reply, here is my full code to copy.
FromTableRef.OPEN(TableNo, FALSE, FromCompanyName);
ToTableRef.OPEN(TableNo, FALSE, ToCompanyName);
IF FromTableRef.FINDFIRST THEN
REPEAT
ToTableRef.INIT;
FOR i := 1 TO FromTableRef.FIELDCOUNT DO
BEGIN
FromFieldRef := FromTableRef.FIELDINDEX(i);
// filter here
IF FromFieldRef.NUMBER = 'specific Field ID here' then
BEGIN
ToFieldRef := ToTableRef.FIELDINDEX(i);
ToFieldRef.VALUE := FromFieldRef.VALUE;
END;
END;
UNTIL FromTableRef.NEXT = 0;
ToTableRef.CLOSE;
FromTableRef.CLOSE;