Same filter (logical) but different result in Report

First of all, sorry for bad english. I try to describe clearly.

I don’t need another solution to avoid this issue, I only need answer what is wrong with it, how can I fix it. Please help me.

Introduction:

I have two DataItem in my Report: “Vendor Ledger Entry” and under this with same level an “Integer”.

I want to show records from “Purch. Inv. Header” (gRecPIH) table in Integer OnAfterGetRecord trigger with “Vendor Ledger Entry”.“Document No.” filter.

I have only one required filter which is “Document No.”. (“Vendor Ledger Entry”.“Document No.”)

In Integer OnPreDataItem trigger I use setfilter of gRecPIH:


Integer - OnPreDataItem()

gRecPIH.RESET;

gRecPIH.SETFILTER(gRecPIH.“No.”, “Vendor Ledger Entry”.GETFILTER(“Document No.”));

gCounter := 0;

IF gRecPIH.FINDSET THEN BEGIN

REPEAT

gCounter += 1;

gRecTmpVLE.INIT;

gRecTmpVLE.“Entry No.” := gCounter;

gRecTmpVLE.“Document No.” := gRecPIH.“No.”;

gRecTmpVLE.“Document Type” := 2;

gRecTmpVLE.INSERT(FALSE);

UNTIL gRecPIH.NEXT = 0;

END;

SETRANGE(Number, 1, gRecTmpVLE.COUNT);


I have a temp table (Vendor Ledger Entry) and i save No-s into it from filtered Purch. Inv. Header table.

What is interesting in?

If i use different filter formats:

Interval: SB3/0000…SB3/9999

than gRecPIH.COUNT is 1952

gRecTmpVLE.COUNT is 1952. It is correct! Every record is saved, showed.

If i use another format:

Star: SB3/*

than gRecPIH.COUNT is 1952

gRecTmpVLE.COUNT is 501 !!! Incorrect result!

First five hundred records are shown than no more record. Where is the next index pointer? Why its gone?

I tried to use setcurrentkey and ascending but nothing helps.

Please help, how can i fix this filter/result problem?

Hi Tóth,

Did you try to apply the same filter to the same field manually to the table? I think that you will see the same problem with your filter here. I’m not sure but it might be related to the ‘/’ in your filter. What if you set your filter to “SB3*”?

Hi Erik P. Ernst!

Table filter give me the correct result.

It is not related to ‘/’ character.

It is a bug in Nav5.

Thx for reply!

Hi Tóth,

Good to know it’s not the slash that caused the error. I have never used slash in a filter so I didn’t really know.

Did Microrosft confirm this bug, or is it solved in the newer version?

And did you try to specify the filter with SETRANGE instead of SETFILTER? Sometimes SETFILTER works differently. With SETRANGE you specify the start and end filter individually and personally I have always preferred this as it is generally more reliable.