I am using Crystal reports 9 and Sql Server. The code below is sample code from crystal that I am using to add a filter.
' *************************************************************
' Add the selected filters
'
Function addFilters(filterFields, filterTypes, filterValues)
Dim operatorObj, filterObj, fieldValueObj
Dim filterField, filterType, filterValue
On Error Resume Next
Set operatorObj = ObjectFactory.CreateObject("CrystalReports.OperatorFilterItem"

operatorObj.Operator = "AND"
for i = 0 to UBound(filterFields)
' Ensure we have valid values for all the fields
if ( (i <= UBound(filterFields)) and (i <= UBound(filterTypes)) and _
(i <= UBound(filterValues)) ) then
filterField = Trim(filterFields(i))
filterType = Trim(filterTypes(i))
filterValue = Trim(filterValues(i))
if (filterField <> "0" and _
filterType <> "0" and filterType <> "1" and _
filterValue <> ""

and _
filterField <> "" and filterType <> "" and filterValue <> "" then
if dbDefController.Datadefinition.Recordfilter.filterItems.count > 0 then _
dbDefController.RecordFilterController.AddItem -1, operatorObj
Set filterObj = ObjectFactory.CreateObject("CrystalReports.FieldRangeFilterItem"

Set fieldValueObj = ObjectFactory.CreateObject("CrystalReports.ConstantValue"

filterObj.RangeField = findFieldByName(filterField)
addFilterOp filterObj, filterType
fieldValueObj.Value = ConvertToValidFormulaValue(filterObj.RangeField, filterValue)
filterObj.Values.Add(fieldValueObj)
dbDefController.RecordFilterController.AddItem -1, filterObj
end if
end if
next
End Function
I was hoping on using something like filterObj.RangeField.Description = "Dynamic filter"
When I go to view the filter items again I could check the description to tell which filter items need to be prompted for a value before displaying the report to the user.
Thanks