Report runs slow on server

efficeon007efficeon007 Member Posts: 31
edited 2009-05-14 in Navision Financials
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
I am a expert of questions, not the solution provider, but questions submitter.

Answers

  • efficeon007efficeon007 Member Posts: 31
    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.
  • efficeon007efficeon007 Member Posts: 31
    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.
  • efficeon007efficeon007 Member Posts: 31
    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.
Sign In or Register to comment.