BrowseDialog - show data from related table


Author
Message
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
Fabian, no need to apologize for anything! Smile  I am glad that you got it working!
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 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 (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
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 (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 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 (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
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 (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 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 (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
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 (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Thanks for you reply



Can you give me a example of how I can access the BO of the browsedialog to set the method (ex: "FullCustomers") with the inner join / view / sp and the browsedialog show the related columns?



Sorry if those questions are basic and common, I´m learning all I can of Strataframe but don´t have yet learned those stuff like this thing.



[ and Sorry for my bad english, I speak in spanish Blush ]

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
Yes.  You can use a view or an inner join and bring in the data as you please.  So you can do what you had described.  One thing to remember when you do this though, is that when you click OK to select your record, the browse BO copies itself into the BO on your form using the CopyDataFrom() method on the BO.  So if you have fields in your browse table that you do not want in your run-time table, you will want to clean this up in the BrowseClosed event or something.  Just FYI Smile
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Thanks for you reply



If I dont like to use the information panel and see it on a column, can I do this?

example: show the country.Description (idCountry in my customer table)

I can fill the business object with a inner join or something else or I can´t do that? Tongue



thanks for all your help



- Fabian
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