Custom Fields


Author
Message
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
No problem Smile

Edhy Rijo

Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
Perfect. Thank you so much.
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Terry,



The following code is wrong:



Protected Overrides Function GetCustomBindablePropertyDescriptors() As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()

Return New MicroFour.StrataFrame.Business.FieldPropertyDescriptor() { _

New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _

"cowboy_Name", GetType(ContestantsRodeoBO))}

End Function





The GetType should reference the current BO in which the Custom Field Property is being created, so it should be:



Protected Overrides Function GetCustomBindablePropertyDescriptors() As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()

Return New MicroFour.StrataFrame.Business.FieldPropertyDescriptor() { _

New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _

"cowboy_Name", GetType(bbpointsbo))}

End Function



Edhy Rijo

Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
The following code works and in the current data table I get the column called contestantname.





Dim sqlbuilder As New StringBuilder(255)

With sqlbuilder

.AppendLine("SELECT bbpoints.contpk, bbpoints.rodeoid, ")

.AppendLine("bbpoints.eventcd, bbpoints.bbpk, bbpoints.go, ")

.AppendLine("bbpoints.perf, bbpoints.positioninperf, bbpoints.contestantnumber, ")

.AppendLine("bbpoints.section, bbpoints.rideleft, bbpoints.stockleft, ")

.AppendLine("bbpoints.rideright, bbpoints.stockright, bbpoints.totalscore, ")

.AppendLine("bbpoints.reride1, bbpoints.reride2, bbpoints.stockbrand, bbpoints.stockname, ")

'.AppendLine("bbpoints.turnout, bbpoints.outofrodeo, contestants.membershipcd, ")

'.AppendLine("contestants.membershipnumber, contestants.contestantname ")

.AppendLine("contestants.contestantname ")

.AppendLine("FROM bbpoints INNER JOIN contestants ")

.AppendLine("ON bbpoints.contpk = contestants.contpk WHERE (Perf = 1) ")

.AppendLine("ORDER BY perf, section, PositioninPerf ")

End With



Using cmd As New SqlCommand

cmd.CommandText = sqlbuilder.ToString()

Me.FillDataTable(cmd)

End Using





But when I try adding the following code to my bbpointsbo I get the error that follows.





Protected Overrides Function GetCustomBindablePropertyDescriptors() As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()

Return New MicroFour.StrataFrame.Business.FieldPropertyDescriptor() { _

New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _

"cowboy_Name", GetType(ContestantsRodeoBO))}



End Function

'''

''' The collection of required fields for the business object.

'''





BusinessFieldDisplayInEditorAttribute(), _

Description("Cowboy Name"), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _

Public ReadOnly Property cowboy_Name() As String

Get

'Return MyBase.RequiredFields

If Me.CurrentDataTable.Columns.Contains("contestantname") Then

If Not TypeOf (Me.CurrentRow.Item("contestantname")) Is DBNull Then

Return CStr(Me.CurrentRow.Item("contestantname"))

Else

Return ""

End If

Else

Return ""

End If

End Get

End Property







There is a Browsable(False), _ in the above code but does not seem to appear when I preview. I think it has to do with the '<' in front.



Error:



System.NullReferenceException was unhandled by user code

Message=Object reference not set to an instance of an object.

Source=MicroFour StrataFrame Business

StackTrace:

at MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor..ctor(String PropertyName, Type PropertyOwner)

at SFCustomField.BBPointsRodeoBO.GetCustomBindablePropertyDescriptors() in C:\VSProjectsSamples2010\SFCustomField\SFCustomField\BBPointsRodeoBO.vb:line 113

at MicroFour.StrataFrame.Business.BusinessLayer.InternalGetAdditionalPropertyDescriptors()

at MicroFour.StrataFrame.Business.BusinessLayer..ctor()

InnerException:



I'm not sure what to do. I was trying to follow what Edhy and Larry had done in a previous post. But of course I am missing something. Any help would be appreciated. Thanks in advance.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search