Report result not conform to the request filter field

poppinspoppins Member Posts: 647
Hi everyone,

I am running a report to rename some Items in the database...The report is based on the Item table and the request filter fields Gen. Prod. Posting Group.

When I run the report after selecting a particular Gen. Prod. Posting Group and then look at the Item table, I find that there are modified items that do not belong to the selected group...

Before running the report in the customer test database (a huge one), I tried it in the Cronus database and it worked just fine...The issue appears with the customer database...

Can someone explain ????

Comments

  • SavatageSavatage Member Posts: 7,142
    How can we possibly answer that with the info provided..your asking for guesses.

    show your report code perhaps the answer lies in there.

    maybe your not clearing some variable....
    maybe your filter is being cleared somewhere....
  • poppinspoppins Member Posts: 647
    Here is the code (The OnAfterGetRecord trigger):
    IF (COPYSTR("No.",1,2) = 'Y_') THEN CurrReport.BREAK;
    
    CurrentItem.RESET;
    CopyItem.RESET;
    
    IF CurrentItem.GET("No.") THEN
    BEGIN
    
    CopyItem.COPY(CurrentItem);
    num:=CurrentItem."No.";
    CurrentItem.RENAME('Y_'+num);
    CurrentItem.Blocked := TRUE;
    CurrentItem.MODIFY;
    
    CopyItem."Costing Method":=1;
    CopyItem."Last Date Modified" := TODAY;
    
    CopyItem.INSERT;
    
    END;
    
    
  • ChinmoyChinmoy Member Posts: 359
    What are you doing with the CurrentItem and CopyItem. Till CurrentItem is still understood, what are you doing with the CopyItem. You said you want to rename some records. But here you are first renaming a record in the item table and also creating a copy of the (original) item. So, let's say you have a item no. as '76001' in the selected Posting Group, once you report is run, you will have 2 items, 'Y_70061' and '76001'. The code that you have written is working in this manner. If you only want to rename the item records, you don't need two item record variables, you can use this code:

    IF (COPYSTR("No.",1,2) = 'Y_') THEN CurrReport.BREAK;

    CurrentItem.RESET;

    IF CurrentItem.GET("No.") THEN
    BEGIN

    num:=CurrentItem."No.";
    IF (COPYSTR(num,1,2) = 'Y_') THEN CurrReport.BREAK;
    CurrentItem.RENAME('Y_'+num);
    CurrentItem.Blocked := TRUE;
    CurrentItem.MODIFY;

    END;

    Chn
Sign In or Register to comment.