what function do i use to extract the filter value from a request form of a report?
thanks.
It depends on WHEN you want them. You cannot read them before the report is printed/previewed. All filters can be read in PreReport trigger, and after that you can read fitlers in PreDataItem and other DataItem triggers, but just for the actual DataItem or any Parent DataItem. You cannot read filters for nested dataitems...
If you are adjusting the filters for your report on the RequestOptionsForm I go about it this way...
Set global variable(s) to the DataItem(s) your RequestOptionsForm will apply to.
Every control on the form calls a function I make (something like "UpdateFilters" or what have you) and it appears like this:
UpdateFilters()
globalRecordvar.RESET;
globalRecordvar := DataItemRecord;
//Apply all filters according to what is enabled/has value
//...this I have on every RequestOptionsForm and I find it to be rather informative as well as "nifty"...
IF globalRecordvar.ISEMPTY THEN
gRecordCount := 0
ELSE
gRecordCount := globalRecordvar.COUNT;
(I have a textbox which shows the value of gRecordCount letting the e/u know how many records there are with the current filter(s) applied.)
To apply the filters...
DataItemRecord - OnPreDataItem()
COPYFILTERS(globalRecordvar); //Copy filters from record variable used in RequestOptionsForm
Just read the online help for the GETFILTERS, there is example... ;-)
GETFILTERS (Record)
Use this function to return a string which contains a list of the filters within the current filter group for all fields in a record. In addition, this function also returns the state of MARKEDONLY.
String := Record.GETFILTERS
String
Data type: text constant or code
This string contains a list of the filters for all fields in Record.
Record
Data type: record
The record from which you want a list of filters.
Comments
See also GETFILTER, SETFILTER, and SETRANGE.
Example
This example shows how to use the GETFILTERS function.
Answers
http://www.BiloBeauty.com
http://www.autismspeaks.org
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Set global variable(s) to the DataItem(s) your RequestOptionsForm will apply to.
Every control on the form calls a function I make (something like "UpdateFilters" or what have you) and it appears like this:
(I have a textbox which shows the value of gRecordCount letting the e/u know how many records there are with the current filter(s) applied.)
To apply the filters...
i'm trying to get filters in predataitem of a report.
how do i use 'getfilters' function?
thanks in advance for your help..
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
go to the last dataitem - on the blank line under the last dataitem put your cursor & hit F9
You'll see
**Get Your Filters
OnPreReport() **Show Your Filters
Now when you view the sections you'll see a textbox with properties of:
http://www.BiloBeauty.com
http://www.autismspeaks.org