RE: Time too long when viewing report

Hi, is there anyone who knows how can i shorten the time for the end users to preview the report ? Because it seems that the code is already quite short but end users still said that it is really take very long time to load the report. Thank you

Hi Yap, This short resume of the problem is to short to really give you an answer. What is the report supose to do? Is is filtering when you run it, can you set filters to make it quicker… Hope this helps a little.

Ok, well the code is as follows: TotalAmtInSGD := 0; Amt := 0; TotalAmt := 0; AmtInSGD1 := 0; TotalAmtInSGD1 := 0; Amt1 := 0; TotalAmt1 := 0; PurchRcptLineR.RESET; PurchRcptLineR.SETCURRENTKEY(“Document No.”, “Line No.”); PurchRcptLineR.SETRANGE(PurchRcptLineR.“Document No.”, “No.”); PurchRcptLineR.SETRANGE(PurchRcptLineR.Type, PurchRcptLineR.Type::Item); PurchRcptLineR.SETFILTER(PurchRcptLineR.“Qty. Rcd. Not Invoiced”, ‘<>0’); IF NOT PurchRcptLineR.FIND(’-’) THEN BEGIN CurrReport.SKIP; END ELSE BEGIN REPEAT IF “Currency Code” = ‘’ THEN BEGIN AmtInSGD := PurchRcptLineR."Qty. Rcd. Not Invoiced"PurchRcptLineR.“Unit Cost (LCY)”; AmtInSGD1 += AmtInSGD; TotalAmtInSGD := AmtInSGD + ((AmtInSGDPurchRcptLineR.“GST %”) / 100); TotalAmtInSGD1 += TotalAmtInSGD; END ELSE BEGIN Amt := PurchRcptLineR."Qty. Rcd. Not Invoiced"PurchRcptLineR.“Unit Cost”; Amt1 += Amt; TotalAmt := Amt + ((AmtPurchRcptLineR.“GST %”) / 100); TotalAmt1 += TotalAmt; AmtInSGD := PurchRcptLineR."Qty. Rcd. Not Invoiced"PurchRcptLineR.“Unit Cost (LCY)”; AmtInSGD1 += AmtInSGD; TotalAmtInSGD := AmtInSGD + ((AmtInSGDPurchRcptLineR.“GST %”) / 100); TotalAmtInSGD1 += TotalAmtInSGD; END; UNTIL PurchRcptLineR.NEXT = 0; END; And the details are displayed at the purchase receipt header section. By the way there are also two sorting key in the table which is by the name and date. Hope it helps Thank you

If you need this report very often and the users cannot wait the time they are waiting now, you should consider introducing a new key to table Purch. Rcpt. Line with fields Type,“Qty. Rcd. Not Invoiced” (Document No. and Line no. will be implicitly included as these are the primary key fields). This will speed up your report, since at the moment you filter on these fields without an appropiate key. Why don’t you use a second DataItem “Purch. Rcpt. Line” in the report, depending on Purch. Rcpt. Header an put your code there? you can print your results in a PurchRcptLine-Footer then.

It seems that when i use another table, Purch. Rcpt Header, it is slower. And how can i put the code for the filter(fields Type,“Qty. Rcd. Not Invoiced” ) at the Purch. Rcpt. Header? or is there another way? And by the way isn’t the existing filter that i have already put: PurchRcptLineR.SETFILTER(PurchRcptLineR.“Qty. Rcd. Not Invoiced”, ‘<>0’); sufficient?

Your biggest problem is that you are reading through all the Purchase Receipts (all receipts over time) to find the ones that are not invoiced. If you want to read through the Purchase Receipts, then you should be going at the lines with a new key (Qty. Rcd. Not Invoiced)…There is a big difference between setting your filter and setting it using the correct key. This will greatly decrease the number of records read and hence, improve speed. The better place to get this information might be the Purchase Order table, as you might be able to get the same information from a table with (generally) fewer records.

Well, think the problem is that there is no purchase order tables created in my list and only purchase header and purchase line where u will still need to filter out those document type with orders

quote:


Originally posted by pcchua
Well, think the problem is that there is no purchase order tables created in my list and only purchase header and purchase line where u will still need to filter out those document type with orders


I was refering to the Purchase Header/Line tables. I think you might need to review the database layout before you proceed any further with this report. A report written from a poor design will usually run poorly. Back to my original point, compare the number of records in the Purchase Line table to the Purchase Receipt table and you should be able to figure out which one would work better for you. Also, on the Purchase Line, the only type which can have Shipped not invoiced is Order, so if you set your other keys correctly, then you don’t need to filter by Document Type (although it can’t hurt).

yap a/ this should be in the developers forum, b/ please use the [ code] … [ /code] symbols when emtering code.

hi yap, my users allways says ‘to long to wait’ I implemented a short procedure to measure the time and put in in a table to see the time the report uses. Often the user is the problem … Hi David, aren’t your postings quoted ?? how can you reply so fast ?