Multiple Fields Combined in Single Column in TypedListDAO

Posts   
 
    
Posts: 116
Joined: 18-Feb-2006
# Posted on: 21-Apr-2006 21:12:41   

The title says it all. I am trying to return a data table from my Business Layer. The table returns an ID and a combination of [Code + ' - ' + Name] as the Name. this is for a DropDownList, hence the multiple fields to one column so i can display both in a single field.

I have been able to build the typedlistdao with either/or, but i haven't seen anything about a combination

Here's my current code. Any suggestions would be great.

            Dim sorter As New SortExpression()
            sorter.Add(SortClauseFactory.Create(LocationFieldIndex.Name, SortOperator.Ascending))

            Dim dao As New TypedListDAO
            Dim objFields As New ResultsetFields(2)
            objFields.DefineField(LocationFieldIndex.Id, 0, "ID")

            'This needs to be combined with Code to create Code + ' - ' + Name
            objFields.DefineField(LocationFieldIndex.Name, 1, "Name")

            Dim dt As New DataTable("Locations")
            dao.GetMultiAsDataTable(objFields, dt, 0, sorter, LocationFields.DivisionId = DivisionID, _
             Nothing, False, Nothing, Nothing, 0, 0)
            Return dt

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 22-Apr-2006 04:15:59   

You could use a dynamic list that concatenates the fields. Take a look at this thread and see if it helps. http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3472&HighLight=1