Report is in running infinity time

kmkaotkmkaot Member Posts: 261
Dear I have small updation, for posted dimension entries for table 355 table.
I want update real values from 5802.

When I run report, it is running longer time and no results.
even I have added somewhere in the standards reports also

Can suggest what is issues

yvwp7685kqcg.jpg
issue

Warm regards
KMK

Answers

  • ishwarsharma016ishwarsharma016 Member Posts: 50
    This might be happening due to huge data. Try to update for 100 entries at a time and see if it works. If it does, try 1K entries at a time.
    Thanks,
    Ishwar Sharma

    My Blogs: Dynamics Community Blog | Blogspot
    Connect: Google + | Twitter
  • kmkaotkmkaot Member Posts: 261
    also tried with one day transactions.
  • ishwarsharma016ishwarsharma016 Member Posts: 50
    There is huge data in table 355 as well. What is your code? Could you paste it here??
    Thanks,
    Ishwar Sharma

    My Blogs: Dynamics Community Blog | Blogspot
    Connect: Google + | Twitter
  • KishormKishorm Member Posts: 921
    Have you added any new dataitems to the report and if so what have you set in the DataItemTableView?

    In particular have you added an "Integer" dataitem and if so what filters have you set and what code have you got in the OnPreDataItem & OnAfterGetRecord triggers for the DataItem?
  • kmkaotkmkaot Member Posts: 261
    This is code on OnAfterGetRecord
    ======================

    Dimtab.RESET;
    Dimtab.SETCURRENTKEY(Dimtab."Table ID",Dimtab."Entry No.");
    Dimtab.SETRANGE(Dimtab."Table ID",5802);
    Dimtab.SETRANGE(Dimtab."Entry No.","Value Entry"."Entry No.");
    Dimtab.SETFILTER(Dimtab."Dimension Code",'PROFIT CENTER') ;
    IF NOT Dimtab.FIND('-') THEN
    BEGIN
    Dimtab.INIT;
    Dimtab."Table ID":=5802;
    Dimtab."Entry No.":="Value Entry"."Entry No.";
    Dimtab."Dimension Code":='PROFIT CENTER' ;
    Dimtab."Dimension Value Code":="Value Entry"."Global Dimension 1 Code";
    Dimtab.INSERT;
    END
    ELSE
    BEGIN
    Dimtab."Dimension Value Code":="Value Entry"."Global Dimension 1 Code";
    Dimtab.MODIFY;
    END;
  • KishormKishorm Member Posts: 921
    Which dataitem does that OnAfterGetRecord relate to?

    What are the filters on the DataItem?

    How many records in the table that is set as the DataItem?
  • kmkaotkmkaot Member Posts: 261
    posting date filter on table 5802
    with maximum record of 383278
  • ishwarsharma016ishwarsharma016 Member Posts: 50
    Please optimize your code as shown below, It might help..

    Dimtab.RESET;
    Dimtab.SETCURRENTKEY(Dimtab."Table ID",Dimtab."Entry No.",Dimtab."Dimension Code"); // Add "Dimension Code" in the key
    Dimtab.SETRANGE(Dimtab."Table ID",5802);
    Dimtab.SETRANGE(Dimtab."Entry No.","Value Entry"."Entry No.");
    Dimtab.SETFILTER(Dimtab."Dimension Code",'PROFIT CENTER') ;
    IF Dimtab.ISEMPTY THEN //Instead of NOT FIND('-'), use ISEMPTY
    BEGIN
    Dimtab.INIT;
    Dimtab."Table ID":=5802;
    Dimtab."Entry No.":="Value Entry"."Entry No.";
    Dimtab."Dimension Code":='PROFIT CENTER' ;
    Dimtab."Dimension Value Code":="Value Entry"."Global Dimension 1 Code";
    Dimtab.INSERT;
    END
    ELSE
    //BEGIN //Remove this line
    IF Dimtab.FINDFIRST THEN BEGIN // Add this line.
    Dimtab."Dimension Value Code":="Value Entry"."Global Dimension 1 Code";
    Dimtab.MODIFY;
    END; // Add this line
    //END; //Remove this line

    Do not use FIND('-') as it is slower, use FINDFIRST instead. To know more, check http://forum.mibuso.com/discussion/41687/difference-between-find-and-findfirst

    And like I said earlier, try with lesser records. Instead of posting date, apply Entry No. filter on Value Entry DataItem. For eg. 100..200, and then check.
    Thanks,
    Ishwar Sharma

    My Blogs: Dynamics Community Blog | Blogspot
    Connect: Google + | Twitter
  • KishormKishorm Member Posts: 921
    My guess is that it is runnng ok but just taking a while, you can try optimising a bit and committing changes and this should help and will also mean you can stop and then start again and it will not try fixing the ones it's already done.

    Try changing the code to something like...
    IF NOT Dimtab.GET(5802,"value entry"."entry no.",'PROFIT CENTER') THEN BEGIN
      Dimtab.INIT;
      Dimtab."Table ID":=5802;
      Dimtab."Entry No.":="Value Entry"."Entry No.";
      Dimtab."Dimension Code":='PROFIT CENTER' ;
      Dimtab."Dimension Value Code":="Value Entry"."Global Dimension 1 Code";
      Dimtab.INSERT;
    END ELSE IF Dimtab."Dimension Value Code" <> "Value Entry"."Global Dimension 1 Code" THEN BEGIN
      Dimtab."Dimension Value Code":="Value Entry"."Global Dimension 1 Code";
      Dimtab.MODIFY;
      CommitCounter := CommitCounter +1:
      IF (CommitCounter MOD 1000) = 0 THEN
        COMMIT;
    END;
    

    Also, it would be faster if you created a separate "processing only" report for this instead of just adding this code to the Inventory Valuation report.
  • kmkaotkmkaot Member Posts: 261
    It is great help. It is done. very nice of you <3
  • KishormKishorm Member Posts: 921
    kmkaot wrote: »
    It is great help. It is done. very nice of you <3

    Great, in that case please mark this as "Answered" :)

    You can find this under the replies where you should see something like "Did this answer the question YES or NO"
Sign In or Register to comment.