Options

Modifying Records on BOM Components Table

bekiobekio Member Posts: 204
Hello everyone,

If i want to modify some fields in Bom Components table, if i modify just one component i want to update all the components for that Parent Item No.(additional field added (Marked for Export)), so i have added some code declaring Global Variable the Bom Componets table as Record and than i have made some filters to that record variable, and fill this additional field Marked for Export with some value. But when i try to move to another record it displays me a message like in attachment.

Any good suggestions, would help me very much.

Thanks to everyone.

Answers

  • Options
    ara3nara3n Member Posts: 9,256
    Is the line no. the current line no. you are modifying?

    Can you post the code you have to modify all the other records?

    Did you exclude the current record from your code?

    otherrecords.setrange("bom No.","bom No.");
    otherrecords.setfilter("Line No.",'<>%1',"line No.");
    otherrecords.modifyall('marked to export",true);
    "marked to export." := true;
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    bekiobekio Member Posts: 204
    Thanks ara3n,

    Yes i want to modify allso the current line no. I want to modify even the record that i am focused on it. I have created a Codeunit to do this. Any suggestion.

    The code that i am using is:

    BOMComp.RESET;
    BOMComp.INIT;
    BOMComp.SETRANGE(BOMComp."Parent Item No.","Parent Item No.");
    IF BOMComp.FINDFIRST THEN
    REPEAT
    BOMComp."Marked to export":=TRUE;
    BOMComp.MODIFY;
    UNTIL BOMComp.NEXT=0;
  • Options
    ara3nara3n Member Posts: 9,256
    BOMComp.RESET;
    BOMComp.INIT;
    BOMComp.SETRANGE(BOMComp."Parent Item No.","Parent Item No.");
    BOMComp.setfilter("Line No.",'<>%1',"line No.");
    IF BOMComp.FINDFIRST THEN
    REPEAT
    BOMComp."Marked to export":=TRUE;
    BOMComp.MODIFY;
    UNTIL BOMComp.NEXT=0;
    
    "Marked to export":=TRUE;
    
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.