I have a PersonEntity with FirstName MiddleName and SurnameName but I often need to display the full name, so in PersonEntity I've created
Public ReadOnly Property FullName() As String
Get
Return Me.FirstName & Replace(" " & Me.MiddleName & " ", " ", " ") & Me.Surname
End Get
End Property
when filtering/sorting I reference Surname using PersonFields.Surname like:
Dim sorter As New SortExpression(PersonFields.Surname Or SortOrder.Ascending)
What I'd really like to be able to do us reference the FullName in a similar way:
Dim sorter As New SortExpression(PersonFields.FullName Or SortOrder.Ascending)
Is there anyway to get 'FullName' to be added to the ConstantsEnums.vb file during generation so that PersonFields.FullName works? Is this a template thing?
This would be particularly helpful as I'm having trouble getting this to work:
'fields.DefineField(New EntityField("FullName", PersonFields.FirstName + " "+ PersonFields.Surname), 2, "FullName")
in
Dim fields As New ResultsetFields(3)
fields.DefineField(TripStopPersonActivityFields.PersonId, 0)
fields.DefineField(TripStopPersonActivityFields.PersonActivityTypeId, 1, "OnOffBoard", AggregateFunction.Sum)
'fields.DefineField(New EntityField("FullName", PersonFields.FirstName + PersonFields.Surname), 2, "FullName")
fields.DefineField(PersonFields.Surname, 2)
Dim relations As IRelationCollection = New RelationCollection()
relations.Add(TripStopPersonActivityEntity.Relations.TripStopEntityUsingTripStopId)
relations.Add(TripStopPersonActivityEntity.Relations.PersonEntityUsingPersonId)
Dim groupByClause As IGroupByCollection = New GroupByCollection()
groupByClause.Add(fields(0))
groupByClause.Add(fields(2))
groupByClause.HavingClause = New PredicateExpression( _
fields(1).SetExpression(TripStopPersonActivityFields.PersonActivityTypeId * 1).SetAggregateFunction(AggregateFunction.Sum) = 1)
Dim filter As IPredicateExpression = ((TripStopFields.LocationId = locationId) And _
(TripStopFields.StatusId <> StatusEntity.Deleted) And _
(TripStopFields.Etd <= etd))
Dim dynamicList As New DataTable()
Dim dao As New TypedListDAO()
dao.GetMultiAsDataTable(fields, dynamicList, 0, Nothing, filter, relations, True, groupByClause, Nothing, 0, 0)
whereas I can see that
fields.DefineField(PersonFields.Fullname, 2)
would work
Any help gratefully received.
vb.net 2008, winforms, self-serve, llblgenpro v2.6.