StrataFrame Forum

BrowseResultsLayout question...

http://forum.strataframe.net/Topic8106.aspx

By StarkMike - 4/13/2007





Based on the picture above is there any way that I can resolve the LocationID for LocationNames?



I love the fact that I can do it in the SearchFields but it would be really helpful to do it in the ResultsLayout also.



Thanks
By Trent L. Taylor - 4/13/2007

Yes.  The BrowseDialog operates the exact same as a ListView in this fashion.  You will set the results field to be populated through an event instead of a formatted string.  Then in the RowPopulating event you will set the column to the desired value.  There is quite a bit of documentation regarding the BrowseDialog and the RowPopulating event.
By StarkMike - 4/13/2007

Thanks, I'm going to look it up right now.

Sometimes the hardest part is knowing WHERE to look. ;-) Thanks for taking the time to point me in the right direction.

By Trent L. Taylor - 4/13/2007

No problem Wink  Let me know if you get stuck.
By StarkMike - 4/13/2007

That's awesome! I got it to work. ;-) Here's my code:

         With DirectCast(e.BusinessObject, PurchaseOrdersBO)

            Using loBO As New LocationsBO
               loBO.FillByLocationID(.POLocationID)
               e.Values(3).DisplayValue = loBO.LocationName
            End Using

            Using loBo As New ProcessBO
               loBo.FillByProcessID(.POProcessID)
               e.Values(2).DisplayValue = loBo.ProcessName
            End Using

         End With

My only concern is that I am making a round trip to the database twice per row, which depending on the number of records returned seems to significantly impact performance. So I'm going to noodle with a way to make it faster.

I've thought about dropping copies of the Location and Process BO on the form and fill them on FormLoad... then I can just lookup the information based on a BO that has already been filled. Now I just need to figure out how to query filled BOs. :-)

By StarkMike - 4/13/2007

Here is my revised code:

            If Me.LocationsBO1.Seek("LocationID=" & .POLocationID) Then
               e.Values(3).DisplayValue = Me.LocationsBO1.LocationName
            End If

            If Me.ProcessBO1.Seek("ProcessID=" & .POProcessID) Then
               e.Values(2).DisplayValue = Me.ProcessBO1.ProcessName
            End If

It's MUCH faster ;-)

Let me know if you think there is a more efficient approach. Thanks!

By Trent L. Taylor - 4/13/2007

It looks good.  It is hard for me to tell how you are retrieving the data from within the event now, but the best and fastest way (when not included in the SELECT of course) to retrieve data is by using scalar methods.  If you place a packet sniffer on the machine executing the query when using a scalar method, you will see that there is VERY little code that goes across the line and only a single value that comes back....thus it is very fast.  I am glad that you got it working! Smile