- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
Dynamic list error
Joined: 01-Sep-2005
Hi,
Listed below are the error and codes for the dynamic list I am trying to create. I am pretty new to LLBLGen and the codes were originally written by someone who already left the company. I have no idea where the OrderSearchPaymentInfo and OrderSearch come from. They are not tables in our database. I would really appreciate it if you could give me some hints.
Thanks a lot.
Stack trace:
No accessible overloaded 'ResultsetFields.DefineField' can be called with these arguments without a narrowing conversion: Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.AddressFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.AddressTypeRefFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.ApplicationResourceRefFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.AppointmentFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.AppointmentPreferenceRefFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.AppointmentTimeSlotFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.AppointmentTimeSlotRouteFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.AppointmentTimeSlotTruckFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.AppointmentTruckTechFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.BatchCloseFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.BatchCloseRemitSummaryFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction ) Public Sub DefineField ( ByVal fieldToDefine As Sears.UltraCare.DAL.CnvAddressFieldIndex, ByVal indexInResultset As Integer, ByVal fieldAlias As String, ByVal entityAlias As String, ByVal aggregateFunctionToApply As SD.LLBLGen.Pro.ORMSupportClasses.AggregateFunction )........(list just goes on..)
at Microsoft.VisualBasic.CompilerServices.VBBinder.set_InternalThrow(Exception Value) at Microsoft.VisualBasic.CompilerServices.VBBinder.BindToMethod(BindingFlags bindingAttr, MethodBase[] match, Object[]& args, ParameterModifier[] modifiers, CultureInfo culture, String[] names, Object& ObjState) at Microsoft.VisualBasic.CompilerServices.VBBinder.InvokeMember(String name, BindingFlags invokeAttr, Type objType, IReflect objIReflect, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn) at Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) at Sears.UltraCare.BL.RM.OrderManager.GetSearchOrderRecordsTotal(Guid ownerID, String orderNumber, Guid orderTypeRefID, Guid orderStatusRefID, Guid territoryID, String creditCardNumber, String checkNumber, DateTime StartDate, DateTime EndDate) in C:#local files\clients\sears\UltraCare2\Sears.UltraCare.BL.RM\OrderManager.vb:line 1783 at Sears.UltraCare.PL.UltraCareWeb.OrderLookup.BindOrders() in C:#local files\clients\sears\phase1\Construction\Code\UltraCareWeb\WebModules\Order\OrderLookup.aspx.vb:line 200 at Sears.UltraCare.PL.UltraCareWeb.OrderLookup.btnSearch_Click(Object sender, EventArgs e) in C:#local files\clients\sears\phase1\Construction\Code\UltraCareWeb\WebModules\Order\OrderLookup.aspx.vb:line 102
Public Function GetSearchOrderRecordsTotal(ByVal ownerID As Guid, ByVal orderNumber As String, ByVal orderTypeRefID As System.Guid, ByVal orderStatusRefID As System.Guid, ByVal territoryID As System.Guid, ByVal creditCardNumber As String, ByVal checkNumber As String, ByVal StartDate As DateTime, ByVal EndDate As DateTime) As Integer Implements Interfaces.IOrderManager.GetSearchOrderRecordsTotal
Dim adapter As DataAccessAdapter = New DataAccessAdapter
'Dim filter As IPredicate = PredicateFactory.CompareValue(OrderFieldIndex.OrderId, ComparisonOperator.Equal, 10254)
Dim bucket As New RelationPredicateBucket
Dim getPaymentInfo As Boolean = False
'if a cc# or check# is passed set a flag to
If Not creditCardNumber.Equals("") Or Not checkNumber.Equals("") Then
getPaymentInfo = True
End If
Dim fields As New ResultsetFields(1)
fields.DefineField(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.OrderNumber, OrderSearchFieldIndex.OrderNumber), 0, "Total", "Order", AggregateFunction.CountDistinct)
'Construct filters, if the parameter was passed use the filter otherwise ignore the filter
'if a filter is used, use IIf to use the appropriate field index.
If Not orderNumber.Equals("") Then
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.OrderNumber, OrderSearchFieldIndex.OrderNumber), ComparisonOperator.Equal, orderNumber))
End If
If Not orderTypeRefID.Equals(Guid.Empty) Then
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.OrderTypeRefId, OrderSearchFieldIndex.OrderTypeRefId), ComparisonOperator.Equal, orderTypeRefID))
End If
If Not orderStatusRefID.Equals(Guid.Empty) Then
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.LatestOrderStatusRefId, OrderSearchFieldIndex.LatestOrderStatusRefId), ComparisonOperator.Equal, orderStatusRefID))
End If
If Not territoryID.Equals(Guid.Empty) Then
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.TerritoryId, OrderSearchFieldIndex.TerritoryId), ComparisonOperator.Equal, territoryID))
End If
If Not creditCardNumber.Equals("") Then
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.CreditCardNumber, OrderSearchFieldIndex.CreditCardNumber), ComparisonOperator.Equal, creditCardNumber))
End If
If Not checkNumber.Equals("") Then
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.CheckNumber, OrderSearchFieldIndex.CheckNumber), ComparisonOperator.Equal, checkNumber))
End If
If Not StartDate.Equals(DateTime.MinValue) Then
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.OrderDate, OrderSearchFieldIndex.OrderDate), ComparisonOperator.GreaterEqual, StartDate))
End If
If Not EndDate.Equals(DateTime.MinValue) Then
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.OrderDate, OrderSearchFieldIndex.OrderDate), ComparisonOperator.LessEqual, EndDate))
End If
'If Not StartingOrderNo = 0 Then
'bucket.PredicateExpression.Add(PredicateFactory.CompareValue(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.OrderNumber, OrderSearchFieldIndex.OrderNumber), ComparisonOperator.GreaterThan, StartingOrderNo))
'End If
'Only retrieve data for the passed owner
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.OwnerId, OrderSearchFieldIndex.OwnerId), ComparisonOperator.Equal, ownerID))
Dim results As New DataTable
adapter.FetchTypedList(fields, results, bucket, 0, Nothing, False)
Dim ordercount As Integer = results.Rows(0).Item(0)
Return ordercount
End Function
lgege wrote:
I just found out that OrderSearchPaymentInfo and OrderSearch are views created in the backend database. I am wondering whether the errors are caused by the fact they are views instead of tables.
Yes, they're defined as typedviews in your llblgen pro project, is that correct?
What's exactly line 102? (i.e., the error line where the error starts...)
Joined: 01-Sep-2005
In fact OrderLookup.aspx.vb:line 102 calls function GetSearchOrderRecordsTotal in another class -- OrderManager. The real error occors at OrderManager.vb:line 1783, which is also indicated in the stack trace. Line 1783 is:
fields.DefineField(IIf(getPaymentInfo, OrderSearchPaymentInfoFieldIndex.OrderNumber, OrderSearchFieldIndex.OrderNumber), 0, "Total", "Order", AggregateFunction.CountDistinct)
Complete code for this function is posted in the first message. What I am trying to do is to get a count of rows in the view via dynamic list. If there is any easier way to do it, please let me know.
Thanks.
What I am trying to do is to get a count of rows in the view via dynamic list. If there is any easier way to do it, please let me know.
If your view is mapped to a TypedView, then fetch the entire view into a dataTable using FetchTypedView() and then get the dataTable.Rows.Count And if the view was mapped to an Entity, use the FetchEntityCollection and then use the Count property of the collection.