I want to be able to show a field from a joined table on the BrowseDialog listview.


Author
Message
Bill Spack
Bill Spack
StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)
Group: Forum Members
Posts: 4, Visits: 17
Back ground: I have 2 tables CD and Artist. CD has an Artist_FK that joins the Artist table. I want to show the name of the artist from the Artist table, in the search result of the browsedialog instead of the foreign key. I have setup a custom field and it shows in the drop down of the browsedialog browseresultslayout.

When I click the search on the browsedialog I get an error. Artist is not recognized. When I walk through the debug code I see the browsedialog creates it's own fill method to return the results instead of using my fill method that contains the join. Is there a way to specify what fill method to use or a way to include my joined field?

thanks

Bill

Trent Taylor
Trent Taylor
StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, there are a couple of things here.  First of all, you didn't really mention if you were referring to the search fields or the results.  Depending on this you would go two different directions.

If you are referring to the Sarch Fields, then you can handle the Searching event of the browse dialog to maniulate the raw WHERE clause of the query.  Now redirecting to a join will be more difficult since it is another table.  So you may want to create a view to query that has the join done on the server side which would then make this easier without the need to managing the Searching event.

If you are referring to the results, then you can define the column as PopulateThroughEvent and call a scalar method to populate the value or use a browse information panel. 

So there are a lot of different options here, so depending on what you are trying to accomplish this should give you some ideas.

Edhy Rijo
E
StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Bill,

I understand that you want to show the name of the Artist in the Browse Dialog Result listview instead of the Artist_FK value.  This is what you need to do:

  • In the CD business object (BO) you would create a Custom Field Property (CFP  - look in the help file for a sample) named ArtistName or something like that.  This CFP will use the Artist_FK value to search the artist record and return the Artist Name for that property, it would loook like this:

''' <summary>

''' This property will return the Artist Name

''' </summary>

''' <remarks></remarks>

<Browsable(False), _

BusinessFieldDisplayInEditor(), _

Description("ArtistName"), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _

Public ReadOnly Property [ArtistName]() As System.String

     Get

          Dim loBusinessObject As New ArtistBO

          loBusinessObject.FillByPrimaryKey(Me.Artist_FK)

          If loBusinessObject.Count = 1 Then

               Return loBusinessObject.ArtistName

          Else

               Return String.Empty

          End If

          ' Release the Business Object

          loBusinessObject.Dispose()

     End Get

End Property

  • Then, all you need to do is used this property ArtistName instead of the Artist_FK in your Browser Dialog "BrowseResultLayout" fields.


Edhy Rijo

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Bill.

While setting the BrowseResultsDialog, by the time you are adding your foreign key column to be dislplayed, have a look at the Population Type, choose PopulatedThroughEvent.

Then, go to your BrowseDialog Events and add an event handler for the RowPopulating.

In it, you can deal with sending the appropriate content for the BrowseDialog results column, something like this:

    Private Sub MyBrowseDialog_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) Handles MyBrowseDialog.RowPopulating
        '-- you can use whatever methods suit you better to get the values you need
        '-- you could create a method on your BO with a ExecuteScalar method to bring back only the information needed

        '-- establish locals
        Dim loBO As New MyBO
        loBO.FillByPrimaryKey(MyOtherBO.MyForeignKey)

        '-- set the contents
        With CType(e.BusinessObject, MyBO)
            e.Values(0).DisplayValue = loBO.MyField
        End With
    End Sub

Hope it helps.

Bill Spack
Bill Spack
StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)
Group: Forum Members
Posts: 4, Visits: 17
Sorry about that. I'm refering to the results listview in the browse dialog.

PopulateThroughEvent method sounds like the right one for me. I want to see the artist name in the listview not an info panel. I will just need to make a call to the retrieve the artist name based on the artist_FK on the current row right?

Thanks

Bill

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Oops, it looks like it took me too long to write the post... BigGrin
Bill Spack
Bill Spack
StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)
Group: Forum Members
Posts: 4, Visits: 17
I really appreciate the quick reply from the group.

I ended up using Edhy's sample to resolve my issue. Works great BigGrinBigGrin

Thank you

Bill

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)Strategic Support Team Member (2.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Great you got it goind! Cool
Edhy Rijo
E
StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Bill,

Glad it work for you, but keep in mind that this method will do a trip to the database to get the Artist Name value to be shown in the listview, this is acceptable in most cases if your search in the BD (Browser Dialog) will not return many records, but if that is the case, there are many alternate methods like Trent and Ivan said, in which you can use either use an Scalar method to just return the Artist Name field or to create a temporary BO in the BD with all the Artist Name and use the BO.SeektoPrimaryKey(Artist_FK) to get its name in the RowPopulation event.

Edhy Rijo

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