How to Add a Date Filter to a BDC

for Tammie, apologies for the late reply. i hope you will still find this useful.

I’ve worked with BDCs quite a bit, especially when MOSS was still very new (B2, B2TR, Gold Code, and RC). This is the only way I’ve gotten Date Filters to work in BDCs.

1. In the <FilterDescriptors> section, add your date filter descriptor.

<FilterDescriptor Type="Comparison" Name="Date Entered">
  <Properties>
    <Property Name="Comparator" Type="System.String">Equals</Property>
  </Properties>
</FilterDescriptor>

2. In the <Parameters> section, add 2 parameters: a low date boundary, and a high date boundary

<Parameter Direction="In" Name="@min_date_entered">
  <TypeDescriptor TypeName="System.DateTime" AssociatedFilter="Date Entered" Name="min_date_entered">
    <DefaultValues>
      <DefaultValue MethodInstanceName="MyListFinder" Type="System.DateTime">2000-01-01 01:01:01Z</DefaultValue>
      <DefaultValue MethodInstanceName="MyListSpecificFinder" Type="System.DateTime">2000-01-01 01:01:01Z</DefaultValue>
    </DefaultValues>
  </TypeDescriptor>
</Parameter>
<Parameter Direction="In" Name="@max_date_entered">
  <TypeDescriptor TypeName="System.DateTime" AssociatedFilter="Date Entered" Name="max_date_entered">
    <DefaultValues>
      <DefaultValue MethodInstanceName="MyListFinder" Type="System.DateTime">3000-01-01 01:01:01Z</DefaultValue>
      <DefaultValue MethodInstanceName="MyListSpecificFinder" Type="System.DateTime">3000-01-01 01:01:01Z</DefaultValue>
    </DefaultValues>
  </TypeDescriptor>

3. For the list of return values, add your datetime column

<Parameter Direction="Return" Name="MyList">
  <TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="MyListDataReader">
    <TypeDescriptors>
      <TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="MyListDataRecord">
        <TypeDescriptors>

<TypeDescriptor TypeName=“System.String” IdentifierName=“my_id” Name=“my_id”>
<LocalizedDisplayNames>
<LocalizedDisplayName LCID=“1033”>CA ID</LocalizedDisplayName>
</LocalizedDisplayNames>
</TypeDescriptor>

<TypeDescriptor TypeName=“System.DateTime” Name=“date_entered”>
<LocalizedDisplayNames>
<LocalizedDisplayName LCID=“1033”>Date Entered</LocalizedDisplayName>
</LocalizedDisplayNames>
<Properties>
<Property Name=“DisplayByDefault” Type=“System.Boolean”>true</Property>
</Properties>
</TypeDescriptor>

</TypeDescriptors>
</TypeDescriptor>
</TypeDescriptors>
</TypeDescriptor>
</Parameter>

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s