Very Slow Report

siyaksiyak Member Posts: 66
Hi there good people!! Please help ](*,)

I've created a report which has the following dataitems
(
Customer
Sales Cr.Memo Header
Account Types
Customer Bank Account
)Indented in that order and i have this code under Sales Cr.memo Heder(
PostedDocDimension.SETRANGE(PostedDocDimension."Table ID",114);
PostedDocDimension.SETRANGE(PostedDocDimension."DimensionCode",'ACCTYPE');
PostedDocDimension.SETFILTER(PostedDocDimension."Document No.","Sales Cr.Memo Header"."No.");
PostedDocDimension.SETFILTER(PostedDocDimension."Line No.",'0');
IF PostedDocDimension.FIND('-') THEN;
vCust.SETFILTER("No.",AccType."Customer No.");
vCust.FIND('-');
CampaignNo := "Sales Cr.Memo Header"."Campaign No.";)

Itried to the SETCURRENTKEY(SETCURRENTKEY("Sell-to Customer No.","No."),
It is working very well,but it is very very slow

Comments

  • BeliasBelias Member Posts: 2,998
    first of all, if you are in version 4.01 and above, you should use findfirst instead of find('-')...but also read the online guide about the CORRECT USE OF FINDFIRST function...
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • siyaksiyak Member Posts: 66
    Its still very slow
  • BeliasBelias Member Posts: 2,998
    i didn't ask you a very important thing...sql or native database?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • ioriiori Member Posts: 19
    Use SETRANGE instead of SETFILTER.
    SET DataItemTableView and DataItemLinkReference and DataItemLink ...
    BTW, is there any other code in your report? I don't think it should be that slow while running so few codes...
  • DaveTDaveT Member Posts: 1,039
    Hi Siyak,

    Why are you not using GET instead of FIND - look to me like you are looking up the primary keys on the customer and posted document dimension tables

    i.e.
    if PostedDocDimension.GET(114,.","Sales Cr.Memo Header"."No.", 0, 'ACCTYPE' ) then
    ...

    if vCust.GET(AccType."Customer No.") then
    ...

    This may not be the only cause for the report to slow down - the links on the dataitems would need to be examined.

    Hope this helps
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • siyaksiyak Member Posts: 66
    I'm using the SQL Database.
    I have these on the DataitemTableviewof Sales Cr Memo(SORTING(Sell-to Customer No.,No.) and Customer(Sorting(No.))and Customer Bank Account(SORTING(Customer No.,Code)) the DataItemLink are fine.
  • BeliasBelias Member Posts: 2,998
    and how big is your database?
    maybe it's "only" a complicated elaboration on a huge amount of data...
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • siyaksiyak Member Posts: 66
    its about 2,097,152 kb.
  • DaveTDaveT Member Posts: 1,039
    Hi Siyak,

    Can you explain what you are trying to acheive as the design of report is very important.
    For example you have a dataitem for customer and are then using a variable vCust to get customer details again :-s

    Also on the dataitem link you don't seem to have (or maybe didn't post) any where clause so this would mean looping all credit notes for each customer and not just the credit notes for that customer.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • siyaksiyak Member Posts: 66
    On the Account Types Section body i have(Customer No. and name from Customer table and Credit Memo.No From redit memo table and Payment method,Payment type,credit Rep From Account types table) and on the Customer Bank account Body(Code,Description and Bank account no.from Customer Bank Account Table)
    That is the way it looks.It works very well but its slow ](*,)
Sign In or Register to comment.