Cascaded business objects editing


Author
Message
Jiri Brazda
Jiri Brazda
StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)
Group: StrataFrame Users
Posts: 78, Visits: 356
Hi,

I have 3 or more cascaded objects - for example: Country (CountryID and CountryName columns), Town (TownID, TownName and CountryID columns) and Street (StreetID, StreetName and TownID columns) - just for illustration, I'm not using objects for towns and streets Wink. There is 1:N relationship between Country and Town (through CountryID column) and 1:N relationship between Town and Street (through TownID column).

Now I want to use StrataFrame standard windows form for adding and editing of Street object. It works fine with Street object as a primary object. I can even use combo for selecting town. But I would like to use another combo that would be used for selecting country and based on selected country the combo with towns filtered - however I do not know how to do it since there is no direct relationship between Country and Street objects. Is there any possibility to make it?

Thanks a lot

Jiri Brazda

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
I guess my confusion here is that I see a relationship.  Why can't you just create an INNER JOIN query that allows the countries to filter the towns based on the streets (or any combination therein).

Unless I am totally missing you here, let's just forget which form you are on.  You said that you have a relationship like this:

Countries -> Towns -> Streets

If this is the case, then regardless of where you are, you can filter any combination based on the country.  For example let's assume that I have the following structure:

Countries

ct_pk - INT - Primary Key
ct_Name - VARCHAR(128)

Towns

tw_pk - INT - Primary Key
tw_ct_pk - INT - Foreign Key of Countries
tw_Name - VARCHAR(128) - Name of town

Streets

st_pk - INT - Primary Key
st_tw_pk - INT - Foreign Key of Towns
st_Name - VARCHAR(128) - Name of street

OK, I know that this is a simple structure example, but I am not getting your problem, so let's just take this structure sample.  In the case that all I have is the countries and I want to get the streets based on the selected country, I would create a query something like this:

SELECT
     Streets.*
FROM Streets, Towns, Countries
     WHERE Streets.st_tw_pk = Towns.tw_pk AND Towns.tw_ct_pk = Countries.ct_pk AND Countries.ct_pk = MySelectedCountryValue

In the above query, I would just be passing over the MySelectedCountryValue as an INT of the selected country from the combo.  I am not sure if I am in the ballpark here of your problem, but there is generally always some type of relationship that you can use to get back to the data, so I guess that is my point of confusion in your problem here.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Jiri,



To add to what Bill and Trent both said, I think on the limb form you need:



- combo that allows user to choose the forest. This is an unbound combo...they are just using it to filter the list of available trees. It uses population list settings that hit a fill method of the Forest BO, but the Forest BO isn't needed on the form at all. Likely you'll set the SelectedValue to the ID of the forest. Then setup an event handler on the SelectedIndexChanged, and requery the Tree combo.

- combo that allows user to choose the tree. This is bound, as it represents the parent of the limb. This uses population list settings that use a Fill method on the Tree BO that requires a Forest ID as a filter. As such, you'll need to have a ListPopulating event handler that sets this parameter from the SelectedValue of the forest combo above.



Now, you might need to handle a couple of other situations:

- When a record is navigated, you'll likely need to select the forest associated with the tree, so the user isn't confused/can easily change the tree within the same forest. Lots of ways to do this, but you might consider a custom field property on the limb BO. You could either look it up every time (most direct, easiest to understand/do) or you could include the field in the Fill method. Lots of options here and strictly speaking, not on topic Ermm

- If there is an existing tree set and then the user changes the forest, you'll need to clear the tree, as it won't match the forest anymore. I'd try just clearing the tree combo before requerying it in the SelectedIndexChanged event handler of the forest combo.



Hope that makes sense and is what you are looking for. BigGrin
Jiri Brazda
Jiri Brazda
StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)StrataFrame User (224 reputation)
Group: StrataFrame Users
Posts: 78, Visits: 356
Bill, Trent, Greg,

thank You for Your responses! Based on Your posts I have manage it.

In fact the problem was that I tried to automate the country combo behavior by setting is as bound control with object relationships. As I have written before I'm very new to StrataFrame and I like it because a lot of things are automated. So I tried to get it as automated as possible to take advantage of StrataFrame.

Now I have unbound combo with countries and I handle events manually.

Thank You ones more :-)

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Good to hear! BigGrin
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Jiri Brazda - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Jiri Brazda - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Jiri Brazda - 17 Years Ago
                         What is the real-world application of this kind of data principle? You...
Bill Cunnien - 17 Years Ago
                             The real world application is very difficult to describe here. However...
Jiri Brazda - 17 Years Ago
                                 Ok...maybe I am getting it (my skull is much thicker than the average...
Bill Cunnien - 17 Years Ago
                                     I guess my confusion here is that I see a relationship. Why can't you...
Trent L. Taylor - 17 Years Ago
                                         Jiri,

To add to what Bill and Trent both said, I think on...
Greg McGuffey - 17 Years Ago
                                             Bill, Trent, Greg, thank You for Your responses! Based on Your posts...
Jiri Brazda - 17 Years Ago
                                                 Good to hear! :D
Greg McGuffey - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search