Quantcast
Viewing all articles
Browse latest Browse all 64865

Forum Post: RE: Code for filter

HI chintan29,

some tips to filter the data using C/AL Code

In the request form (or request page depends on if you use classic or rdlc report) report you can define 2/3 global variables to assign document no, customer no, date filter etc.

After enter the fields in the request form (textbox fields), then assign "TableRelation" property to fields, for example you can assign relation to "customer table" to extract &/ select customers from list and assign to value to global varible; you can input data manually in fields.

for example:

global varables

gblCustomerNo  > Type code 20> global for "Customer No." filed value

gblDocumentDate  > Type Date

gblDocumentNo Type code 20  > global for "Document No." fileld value

etc.. etc..

DataItems in the report you can pass filters in triggers "OnPreDataItem" DataItems of Customer and Sales Invoice Header can apply filters using the standard NAV functions SETRANGE and SETFILTER, using global variables assigned in the request form at Runtime.

To pass filters :

On Customer DataItem

SETRANGE ("No.", gblCustomerNo)

SETFILTER ("No.", '% 1 ..% 2 |% 3', '100 ', '200', '300 ');

on SalesInvoiceHeader

SETRANGE("No.", gblDocumentNo);

SETFILTER("Bill-to Customer No.", gblCustomerNo)    > direct filter

SETRANGE("Bill-to Customer No.", DataitemCustomer. "No.");   > dynamic filter by dataitem Customer

Some filters examples:

SETRANGE("Document No.", gblDocumentNo)

SETRANGE("Posting Date", gblDate)

SETFILTER ("Posting Date", '% 1', gblDate);

SETFILTER ("Posting Date", '% 1 ..% 2', FromDate, ToDate);

SETFILTER

msdn.microsoft.com/.../dd354919.aspx

SETRANGE

msdn.microsoft.com/.../dd355053.aspx

C/AL Functions

msdn.microsoft.com/.../dd354975.aspx


Viewing all articles
Browse latest Browse all 64865

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>