Report runs slow on server

efficeon007
Member Posts: 31
We have a VAT account = 47210016 but user forgot to set VAT setting for this account. So
our "Libro facturas recibidas" (Paper invoices received) shows the amount of this VAT account always incorrect. So we have to use code in this report and fix the amount problem:
IF MovIVA."Fecha registro" >= 010107D THEN
MemIntIVA.Type := '';
MovContabilidad.SETRANGE("Nº asiento","Nº asiento");
MovContabilidad.SETRANGE("Importe IVA",Importe);
MovContabilidad.SETRANGE("Nº cuenta",'47210016');
IF MovContabilidad.FIND('-') THEN BEGIN
MemIntIVA."% IVA" := 16;
MemIntIVA."% RE" := 0;
MemIntIVA.Type := 'I';
Importe := Base;
Base := Importe/16*100;
"Importe divisa-adicional" := "Base divisa-adicional";
"Base divisa-adicional" := "Importe divisa-adicional"/16*100;
END;
The problem is after add the above code in report, the report runs very slow on server; Nevertheless it runs very fast on my own desktop. Both server and my desktop use Navision local database (*.fdb), and the server hardware is much stronger than my desktop. Could you please let me know why? I attached fob files for your reference.
Another question is I am not sure if the attached file is the correct place to set the VAT account, could you please advise?
Thanks and regards,
Eugene
our "Libro facturas recibidas" (Paper invoices received) shows the amount of this VAT account always incorrect. So we have to use code in this report and fix the amount problem:
IF MovIVA."Fecha registro" >= 010107D THEN
MemIntIVA.Type := '';
MovContabilidad.SETRANGE("Nº asiento","Nº asiento");
MovContabilidad.SETRANGE("Importe IVA",Importe);
MovContabilidad.SETRANGE("Nº cuenta",'47210016');
IF MovContabilidad.FIND('-') THEN BEGIN
MemIntIVA."% IVA" := 16;
MemIntIVA."% RE" := 0;
MemIntIVA.Type := 'I';
Importe := Base;
Base := Importe/16*100;
"Importe divisa-adicional" := "Base divisa-adicional";
"Base divisa-adicional" := "Importe divisa-adicional"/16*100;
END;
The problem is after add the above code in report, the report runs very slow on server; Nevertheless it runs very fast on my own desktop. Both server and my desktop use Navision local database (*.fdb), and the server hardware is much stronger than my desktop. Could you please let me know why? I attached fob files for your reference.
Another question is I am not sure if the attached file is the correct place to set the VAT account, could you please advise?
Thanks and regards,
Eugene
I am a expert of questions, not the solution provider, but questions submitter.
0
Answers
-
Sorry, it looks the fob (object) files can not be uploaded. I am sorry. If you need them, I can send them to your email box. Thanks again.I am a expert of questions, not the solution provider, but questions submitter.0
-
Look at the below code, do you think "MovContabilidad.FIND('-')" make the report performance low? Is there a way to replace it? Thanks a lot!
IF MovIVA."Fecha registro" >= 010107D THEN
MemIntIVA.Type := '';
MovContabilidad.SETRANGE("Nº asiento","Nº asiento"); //transaction No. needs equal
MovContabilidad.SETRANGE("Importe IVA",Importe); //VAT amount needs equal
MovContabilidad.SETRANGE("Nº cuenta",'47210016'); //VAT account equals to 47210016
IF MovContabilidad.FIND('-') THEN BEGIN
...
...
END;
IF MovContabilidad."Nº cuenta" = 47210016 THEN BEGIN //I have tried this, no luck
...
...
END;
I am a expert of questions, not the solution provider, but questions submitter.0 -
Below is the solution, after added the two lines and modified MovContabilidad table, it runs much faster.
...
MovContabilidad.SETCURRENTKEY("Nº cuenta","Nº asiento","Importe IVA"); //add SQL index query in MovContabilidad table as KEYs
MovContabilidad.SETRANGE("Nº cuenta",'47210016'); //use this filter FIRST to filter some redundant data
...I am a expert of questions, not the solution provider, but questions submitter.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions