Problem with item selection in a report

Hi everyone,

I am trying to modify the rounding precision for certain items…so I built a report based on Item table with the following code:

OnPreDataItem() trigger

recItem.SETFILTER("No.",'%1 | %2,','1000','1001');

OnAfterGetRecord() trigger

CurrReport.BREAK;

OnPreReport() trigger

IF recItem.FINDSET THEN
BEGIN
REPEAT
recItem."Rounding Precision":=0.01;
recItem.MODIFY;
UNTIL recItem.NEXT=0;
END;

The result I get is that all the items have been modified, not just those I set with SETFILTER…
I feel that the code is mis-placed…
Can you help???

On Prereport trigger will be excecuted before onpredataitem trigger…so it loop through all items and modified…

I told you I felt the code is mis-placed…So, where to place the code for a correct result???

What are the dataitems you have?

What is the main purpose of report?

I have only one dataItem based on the Item table…

The purpose of the report is to change the rounding precision for certain items…

Did you also take recItem as variable?

then remove it and set

SETFILTER(“No.”,’%1 | %2,’,‘1000’,‘1001’);

filter in OnpreDataitem

and

“Rounding Precision”:=0.01;
MODIFY;

in OnAftergetrecord trigger…

OK…

I tried what you said and it only modified the first item mentionned in the filter…

You wrote below code in OnAftergetrecord trigger only, right?

“Rounding Precision”:=0.01;
MODIFY;

Yes…

Remove , after %2 in below statement

SETFILTER(“No.”,’%1 | %2,’,‘1000’,‘1001’);

should be

SETFILTER(“No.”,’%1 | %2’,‘1000’,‘1001’);

[:$]

Thank you for your patience!!!

Welcome