BrowseDialog - show data from related table


Author
Message
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I try to show on a browsedialog a column from a related table (example: Custeomers.IdCountry --> show Country.Description) without sucess, how I can accomplish this? thanks!



- Fabian
Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Your English is great....MUCH better than my Spanish! Smile  What I would probably do is create a view and then create a BO that represents that view.  Then in the BrowseClosed event of the BrowseDialog, I would take the primary key of the returned record and pull the actual record for the run-time BO.  Does that make sense?  If not, let me know and I will go into more detail.
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
This alternative sound great, but I don' t know how to create a BO from a View Blush

please can you give me some light about this?



Do While True

Forum.WriteLine("Thanks!")

Loop





- Fabian
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
First, you will need to create your view.  If you are using the Database Deployment Toolkit you can deploy your view, but the BO Mapper will not allow you to choose the view from the DDT.  In order to choose a view through the BO Mapper, you must select the view directly from the SQL Server database.  You can overwrite the connection on a per BO basis so you will just need to provide the connection to the server where the view resides.  After that, there is no difference.  You will then use the BO that represents the view in your BrowseDialog.  Once the record is selected, you will then want to handle the BrowseDialogClosed event and then populate the BO on the form:

Private Sub BrowseDialog1_BrowseDialogClosed(ByVal e As System.EventArgs) Handles BrowseDialog1.BrowseDialogClosed
        '-- Load the BO that is bound to the fields on the form
        MyFormBO.FillByPrimaryKey(MyViewBO.PrimaryKeyField)
    End Sub

So here are the steps:

  1. Create a view and make sure that it is deployed to your server
  2. Create a new BO
  3. Map the view directly from the SQL Server to the new BO
  4. Attach your view BO to the browse dialog
  5. Drop a "temporary" view BO on your form and select this as your BO instance on your BrowseDialog.  This is represented in the MyViewBO in the code above
  6. Once a record is selected within the Browse, load your form BO with the proper record.  This is the code sample above.

Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I followed all the steps it appears to work but I have a problem in

Private Sub brwProvincias_BrowseDialogClosed(ByVal e As System.EventArgs) Handles brwProvincias.BrowseDialogClosed

Me.ProvinciasBO1.FillByPrimaryKey(Me.ProvinciasVistaBO1.IdProvincia)
'Me.ProvinciasBO1.FillByPrimaryKey(Me.ProvinciasVistaBO1.PrimaryKeyField)

End Sub

---------------------------------------------------------------------
it give me 0 in the value of Me.ProvinciasVistaBO1.IdProvincia (my "Form BO primaryKey")

i created a "ViewBO" and dropped a instance on the form (viewBO1), set the browsedialog to populate it.

Thanks
- Fabian


Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I am a bit unclear on your last post.  Are you indicating that the primary key in the ProvinciasVistaBO1 is zero so when you try to fill the Provincias BO you do not get any records?  Do you have any records in the ProvinciasVista BO at all in the BrowseDialogClosed method?
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K

I test on BRW_closed....
>? Me.ProvinciasVistaBO1.count
result: 7

it have 7 records

sorry, I ommited I have a primary key with seed 0, It appears that the BO "ProvinciasVistaBO1" don´t move from his first record, I test to delete the "id 0" record and the first record have to be the id 1 and when I run another test, this retrieve the 1st record again... (with id 1 this time), If I put on debug Me.ProvinciasVistaBO1.movenext I give the 2nd record viewed on the form....and so on

I made a mistake on something? thanks for you big patience Trent Blush

- Fabian


Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Fabian, no need to apologize for anything! Smile  I am glad that you got it working!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Fabian R Silva, - - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Fabian R Silva, - - 18 Years Ago
Trent L. Taylor - 18 Years Ago
                     Thanks for you reply

Can you give me a example of how I can...
Fabian R Silva, - - 18 Years Ago
                         Your English is great.... MUCH better than my Spanish! :) What I...
Trent L. Taylor - 18 Years Ago
                             This alternative sound great, but I don' t know how to create a BO...
Fabian R Silva, - - 18 Years Ago
                                 First, you will need to create your view. If you are using the...
Trent L. Taylor - 18 Years Ago
                                     I followed all the steps it appears to work but I have a problem in...
Fabian R Silva, - - 18 Years Ago
                                         I am a bit unclear on your last post. Are you indicating that the...
Trent L. Taylor - 18 Years Ago
                                             I test on BRW_closed.... >? Me.ProvinciasVistaBO1.count result: 7...
Fabian R Silva, - - 18 Years Ago
                                                 Fabian, no need to apologize for anything! :) I am glad that you got...
Trent L. Taylor - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search