How to: Use FlowFilters in OData URIs
You can set FlowFilters on the data that your OData web service extracts from the Microsoft Dynamics NAV database.
FlowFilters are a special kind of filter that you use to set ranges on calculations that are shown in FlowFields. For more information, see FlowFilters. FlowFilters for a page are included in the metadata for that page when it is published as a web service. You can then use FlowFilters as filters in a URI that specifies a query against page data. However, only those FlowFilters that are required to calculate the FlowFields that are exposed on the page as controls are included.
Using FlowFilters to Query Data on the Item Card Page
In this procedure, you create and publish a web service from the Item Card page in Microsoft Dynamics NAV and then query the data in that web service by using a FlowFilter.
To query data on the Item Card page using a FlowFilter
Register and publish a page web service by using the RoleTailored client as described in Walkthrough: Creating and Interacting with a Page Web Service (OData). Register and publish page 30, Item Card, and name the service ItemCard.
Start Windows Internet Explorer, and then in the Address field, enter a URI in this format:
If Microsoft Dynamics NAV Server is running on the local computer and uses the default Microsoft Dynamics NAV Server instance and the default OData port, then the address is:
Examine the metadata that is returned by this URI. At the end of the list is a set of parameters that end in the word
Filter. This is the list of FlowFilters for the page:
<Property Type="Edm.String" Name="Location_Filter" Nullable="true"/> <Property Type="Edm.String" Name="Drop_Shipment_Filter" Nullable="true"/> <Property Type="Edm.String" Name="Variant_Filter" Nullable="true"/> <Property Type="Edm.String" Name="Lot_No_Filter" Nullable="true"/> <Property Type="Edm.String" Name="Serial_No_Filter" Nullable="true"/> <Property Type="Edm.String" Name="Date_Filter" Nullable="true"/>
The set of FlowFilters that is listed in the page metadata may not match the set of FlowFilters on the equivalent page in the RoleTailored client. This is because the RoleTailored client shows all FlowFilter fields that are defined on the table on which the page is based. The metadata only shows the FlowFilters that are used to calculate the FlowField controls that are exposed on the page.
Create a URI that returns information for a single item card. For example:
This is the "ATHENS Mobile Pedestal" item. The value for the Qty_on_Sales_Order parameter is 33:
Apply a FlowFilter to that item and specify GREEN as the value for the Location_Filter:
http://localhost:7048/DynamicsNAV/OData/Company('CRONUS%20International%20Ltd.')/ItemCard('1906-S')?$filter=Location_Filter eq 'GREEN'
The item is returned as before, the value of the FlowField that has changed. The value for the Qty_on_Sales_Order parameter is now 27:
This indicates that there are 27 ATHENS Mobile Pedestals on sales orders designated for the GREEN location.