Remove a record based on a filter from a CSV file

How can I delete a record from a table based on the item No that exists in a CSV File?
I have 3090 Item Nos
wiv26tq0n4gf.png

For example, I would like to SetRange("Item No.", 'Item #1 from the excel sheet')
IF Findfirst() then
Delete();
and then SetRange("Item No.", 'Item #2 from the excel sheet') and so on

Best Answer

  • KTA8KTA8 Member Posts: 397
    Answer ✓
    You could use excel buffer to read data and then process it.
    Something like this
    --

    CLEAR(ExcelBuff);
    ExcelBuff.DELETEALL();
    FileName:=CommonDialogMgt.OpenFile(Text001,'',2,'',0);
    ExcelBuff.LOCKTABLE();
    SheetName:=ExcelBuff.SelectSheetsName(FileName);
    ExcelBuff.OpenBook(FileName,SheetName);
    ExcelBuff.ReadSheet();

    ExcelBuff.FINDLAST();
    LastRow:=ExcelBuff."Row No.";
    column:=1;
    ExcelBuff.FINDFIRST();

    For row=2 to LastRow DO BEGIN
    item:=ExcelBuff.GET(row,column);
    your delete
    END;

Answers

  • KTA8KTA8 Member Posts: 397
    Answer ✓
    You could use excel buffer to read data and then process it.
    Something like this
    --

    CLEAR(ExcelBuff);
    ExcelBuff.DELETEALL();
    FileName:=CommonDialogMgt.OpenFile(Text001,'',2,'',0);
    ExcelBuff.LOCKTABLE();
    SheetName:=ExcelBuff.SelectSheetsName(FileName);
    ExcelBuff.OpenBook(FileName,SheetName);
    ExcelBuff.ReadSheet();

    ExcelBuff.FINDLAST();
    LastRow:=ExcelBuff."Row No.";
    column:=1;
    ExcelBuff.FINDFIRST();

    For row=2 to LastRow DO BEGIN
    item:=ExcelBuff.GET(row,column);
    your delete
    END;
Sign In or Register to comment.