Hello everybody,
Could please somebody help me out with two my problems or recommend me the best way to get around them.
I have the following code:
Dim ewi As New EntityCollection(Of EquipmentWorkItemEntity)
Dim pfp As IPrefetchPath2 = New PrefetchPath2(CInt (EntityType.EquipmentWorkItemEntity))
pfp.Add(EquipmentWorkItemEntity.PrefetchPathWorkItem)
pfp.Add(EquipmentWorkItemEntity.PrefetchPathRecurrance)
Dim filter As IRelationPredicateBucket = New RelationPredicateBucket
filter.PredicateExpression.Add(New FieldCompareNullPredicate(RecurranceFields.NotifyDaysPrior, Nothing, True))
filter.PredicateExpression.Add(New FieldCompareNullPredicate(EquipmentWorkItemFields.NextDueByDate, Nothing, True)) 'NextDueDate is not null
filter.PredicateExpression.AddWithAnd(New FieldCompareValuePredicate(EquipmentWorkItemFields.NextDueByDate, Nothing, ComparisonOperator.LessEqual, EquipmentWorkItemFields.InActiveDate))
Dim sorter As ISortExpression = New SortExpression()
sorter.Add(New SortClause(EquipmentWorkItemFields.ActiveDate, Nothing, SortOperator.Ascending))
FetchCollection(ewi, filter, pfp, sorter)
Return ewi.ToList
I have two errors:
1. Unknown field RecurranceFields.NotifyDaysPrior. When I checked created SQL statement, fields only from EquipmentWorkItemEntity got selected.
How can I include RecurranceFields.NotifyDaysPrior in Select list, so filter can go through?
- last filter breaks as well. I think it's because EquipmentWorkItemFields.InActiveDate is Nullable DateTime datatype. I get ": Cannot convert parameter value of type 'SD.LLBLGen.Pro.ORMSupportClasses.EntityField2' to MySQL type 'MySqlType.DateTime''
Can I somehow put a condition: If Not InActiveDate Is Nothing, then apply this filter or there is another approach?
Thank you very much in advance,
Galina.