Mapping a field


Author
Message
Willie van Schalkwyk(1)
Willie van Schalkwyk(1)
StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)
Group: Forum Members
Posts: 3, Visits: 22
Hi all

I suppose this is a elementary question but I am totally new so please bear withSmile



I have a field called Sex char(1) where the values can either be "M" or "F". I want to use a radio button for the selection where the values of the Radio button must be Male and Female. I would like to specify the value within the BO. Is this possible.

Thanks

Willie

 
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'd create a custom, bindable field in the BO that translates the "M"/"F" into 1 and 2 (which can then be bound to the radio button group).  See the Adding Custom Field Properties topic in the SF help file for more information on custom fields.
Willie van Schalkwyk(1)
Willie van Schalkwyk(1)
StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)
Group: Forum Members
Posts: 3, Visits: 22
Thanks Greg

Done it and now the form is displaying. However, when I would edit it and select a value it runs into a neverending loop within the set.

Here is the custom property code :

#Region " Custom Field Properties "

''' <summary>

''' sex

''' </summary>

<Browsable(False), _

BusinessFieldDisplayInEditor(), _

Description("Sex Radion button field"), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _

Public Property [sex_radion]() As System.Int32

Get

Dim loValue As Object

loValue = Me.CurrentRow.Item("sex")

If loValue Is DBNull.Value Then

Return 1

Else

If loValue = "F" Then

Return 2

Else

Return 1

End If

End If

End Get

Set(ByVal value As System.Int32)

If value = 1 Then

Me.CurrentRow.Item("sex") = "M"

Else

Me.CurrentRow.Item("sex") = "F"

End If

End Set

End Property

#End
Region

 

I also added the follwoing:

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

'-- Create and return a new array of FieldPropertyDescriptor

' objects that contains the ReflectionPropertyDescriptor

' for the cust_fullname field.

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

New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _

"sex_radion", GetType(AgentBO))}

End Function


Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'm not seeing anything obvious in this code that would start an infinite loop.  I'd step through the code, starting with whatever action causes the loop to occur. Likely you have some other code that is responding to this action that is causing the loop.
Willie van Schalkwyk(1)
Willie van Schalkwyk(1)
StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)
Group: Forum Members
Posts: 3, Visits: 22
Hi Greg

Ok, got the problem. In my radio button, hidden behind the other there were another 3 buttons. It seemed that the value of one of them also had a value of 2.

Thanks for the help.

Willie
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