Labels

Friday, November 11, 2011

How to decide certain value satisfy filter conditions or not?

Imagine, you have the special field in setup table for defining filter conditions. It could contain a range of items or customers and looks like "C1000..C2000|C2500".
Now, when you proceeding certain record you would like to know, does the "No." of your record satisfies filter conditions or not. I think better way for this is to use filters:
   CustomersL.SETFILTER( "No.", '(%1)&%2', SetupL."Filter Conditions", ProceedingNo);
   IF CustomersL.FINDFIRST THEN MESSAGE('Record satisfies filter');
I hope this little tip would be useful.

3 comments:

Dynamics NAV Enthusiast said...

So simple!
But good example.

Thad Ryker said...

My inclination would be to use:
IF NOT CustomersL.ISEMPTY THEN MESSAGE('Record satisfies filter');
The reasoning being because this call is somewhat more light weight than FINDFIRST depending on the size of one record in whatever table you are using, but regardless it's a nice tip :)

GRIZZLY said...

Tnx, guys!!!