How to create filter in codeunit

I’d like to use codeunit for creating filterig data. So, problem is, how is possible to making filter in code unit. For now, I’ve used report for creating exchange file for integrate NAV in some other software. When I’m using report for creating exchange file is easy to make filter on data. In future I wonna to make more close integration, but I’dont know how to make filter similar like in report. Maybe somebody know how is possible to make code, that I get filtering data in codeunit, like is in report. /Simon

I am not 100% sure of your requirement…

but you can send parameters to Codeunit and filter based on the parameters…

Here is an example of a form sending info to a codeunit.

Form → EmailServiceOrder(Rec);

Codeunit-> ServiceHeader.SETRANGE(“No.”,ServiceHeader.“No.”);

It will auto. fill in “No.” from the form to the SETRANGE