Options

Error on FINDFIRST

gtrgtr Member Posts: 131
Hello,
I have a program that imports items with some logistic information
I can't reproduce the code here - too much
But what happens is strange enough :
I get the error :
The Item cross reference already exists.
Identification fields and values:
Item No.='xxx',Variant Code='',Unit of Measure='yyy',Cross-Reference Type='Bar Code',Cross-Reference Type No.='',Cross-Reference No.='zzz'
And when debugging : it happens on a FINDFIRST :smile: ItemCrossReference.RESET;
Specific CODEUNIT :
...
ItemCrossReference.SETRANGE("Item No.",Item."No.");
ItemCrossReference.SETRANGE("Unit of Measure",ItemLogisticVariant.Code);
ItemCrossReference.SETRANGE("Cross-Reference Type",ItemCrossReference."Cross-Reference Type" :: "Bar Code");
ItemCrossReference.SETRANGE("Cross-Reference No.",XRecItemLogisticVariant."EAN Code");
IF ItemCrossReference.FINDFIRST THEN BEGIN <--- error happens here
ItemCrossReference."Discontinue Bar Code" := TRUE;
ItemCrossReference.MODIFY(TRUE);
END;

I could accept that already exists message appears on insert statement
But on FINDFIRST !?
Perhaps related to Insert Buffers - I read a post about it but could not really figure out how to come to a solution

Please if you have any hint how to avoid this error message - would be nice

Thanks

PS : I have always this smileys that come up every time I write a post - is there way to avoid this ?

Answers

  • Options
    Jan_VeenendaalJan_Veenendaal Member Posts: 206
    This is really a Insert problem. NAV buffers your inserts (as you already found), but only actually performs the insert when the data might be needed (as a result in your FINDFIRST dataset).
    So you need to look at the code where you are creating a new ItemCrossReference - you are probably not using the right (or not all) filters when checking if you need to create a new Item Cross Reference record.
    Jan Veenendaal
  • Options
    gtrgtr Member Posts: 131
    Thanks to you - I found it !
  • Options
    catiamatos1991catiamatos1991 Member Posts: 158
    what have you done to work? I have the same problem..
Sign In or Register to comment.