tying column value to enum in Browse Dialog


Author
Message
Marcel Heitlager
Marcel Heitlager
StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)
Group: StrataFrame Users
Posts: 84, Visits: 835
I'm trying to tie a column value to an enumeration text value in Browse Dialog result.

Public Enum PlanTypes As Integer

Standard = 0

Interest = 1

Custom = 2

CustomInterest = 3

End Enum

My bo has a field called plan_type which contains the integer key.

What value do I change in the RowPopulating event?  

Thanks.


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
This works the very same way as the ListView.  First, have you tried to just allow the enum to populate within it.  By default, any strong-typed column using an enum will attempt to perform a ToString which shold return the enum value without you having to do anything in the RowPopulating.  However, if you choose to go the RowPopulating route, just set the column that will house this value to PopulatedThroughEvent rather the a formatted value.  Then set the event args value when the event is raised:

With CType(e.BusinessObject, MyBOType)
   e.Columns(1).DisplayValue = .MyEnumField.ToString()
EndWith

A better way to parse the enum is to provide an attribute so you can get a more accurate display description:

Public Enum MyEnum As Integer
    <MicroFour.StrataFrame.Tools.EnumDisplayValue("Apple", False)> _
    Item1 = 0
    <MicroFour.StrataFrame.Tools.EnumDisplayValue("Orange", False)> _
    Item2 = 1
    <MicroFour.StrataFrame.Tools.EnumDisplayValue("Pear", False)> _
    Item3 = 3
End Enum

Then parse it out this way:

e.Columns(1).DisplayVaue = MicroFour.StrataFrame.Tools.Common.GetEnumDisplayValue(.MyEnumField)

Marcel Heitlager
Marcel Heitlager
StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)
Group: StrataFrame Users
Posts: 84, Visits: 835
Thanks for the help.  What you put in the last post is actually what I wanted to do.
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