How do I "join" multiple business objects within a project for a query?


Author
Message
StrataFrame Team
S
StrataFrame Developer (4.3K reputation)StrataFrame Developer (4.3K reputation)StrataFrame Developer (4.3K reputation)StrataFrame Developer (4.3K reputation)StrataFrame Developer (4.3K reputation)StrataFrame Developer (4.3K reputation)StrataFrame Developer (4.3K reputation)StrataFrame Developer (4.3K reputation)StrataFrame Developer (4.3K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Greg is right... building the business object from a view would probably be your best option.  However, the OracleConnection.GetSchema() method does not properly return the structure for views, so the BOMapper cannot create a business object directly from a view like you can with SQL Server.  That's where the DDT comes in handy.  You can create the structure of a "pseudo" table for your view and map the business object to that table in the DDT and then fill it with data from the view. 

Other than that, the business objects have a DataTable internal to them, so you can always just fill them with any select statement and they will be populated with the data.  You can then access the columns within the data table using the Item (indexer) property on the business object and pass the string name of the column.

Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K

For reporting purposes I generally create a view using the DDT and then create a ‘read only’ BO based on that view. Like Greg said this allows you to do just about anything you want. I’ve tried the Custom Data field approach but unfortunately the reporting tool that I use, Active Reports 3.0, fails to work properly when using BusinessBindingSource that uses a BO with custom fields.  The result is that I have to create a few more business objects than I’d like but the overall results are good.

 

I’d be interested in hearing if there are other StrataFrame / Active Report users that have successfully used BOs with custom properties as a data source.

 

-Larry

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I've used a couple of techniques to deal with this:



- create a view in the DB and then make a BO based on the view, especially if the view is for read access only. Then you can get as complicated as you need, the view is optimized and you can even to manual optimization (all the stuff you can do with your DB and a view). I've used this to build BOs based on UNION queries where the individual queries included multiple table joins, including outer joins. I understand that the DDT is really helpful in helping to build views (I haven't got around to trying the DDT yet Blush ).



- If the joins are just to provide more data about a FK record, I've also used Custom Data Fields. I.e. if you have an ID to a record in another table, you could use a custom data field to look up other info about that record, like a name. Custom Data fields can be setup to be bindable and even writable. I use the ExecuteScalar usually to get the value and ExecuteNonQuery to do the updates.



I'll be interested to see what Trent/Ben have to say, if there is a better or faster way. Every time I turn around I find out SF has another way of doing something BigGrin





James E Jernigan
James E Jernigan
StrataFrame Beginner (42 reputation)StrataFrame Beginner (42 reputation)StrataFrame Beginner (42 reputation)StrataFrame Beginner (42 reputation)StrataFrame Beginner (42 reputation)StrataFrame Beginner (42 reputation)StrataFrame Beginner (42 reputation)StrataFrame Beginner (42 reputation)StrataFrame Beginner (42 reputation)
Group: Forum Members
Posts: 16, Visits: 101
I have tried to find information about this by searching the documentation file and the forum files but I can't seem to find any information or instructions on how to do this.

I want to join bo1 to bo2 to bo3 etc based on multipart key values ... I think this would be equivalent to creating a 'view' for the selected data files.  Can I create a business object based on a select statement with this criteria in the "where" clause?

I am using Oracle data for this project.  I will ultimately need to relate (join) between 7 or 8 oracle data tables to get all the various pieces of information that I need for a report.  I am doing a basic 'inner join' where I want the multipart key values to exist in both of the joined files.  Would I have to try to set up multiple sets of parent-child relations for the business objects?

I have set up similiar relationships in the VS2005 'data sets' where I have defined multiple 'data tables' within a single data set.  I have not found any reference on how to do this with business objects.  I have also done the SQL Select statement in VS2005 to populate a single data table within a data set with the desired combination of data fields from multiple data tables based on the matching multipart keys.  I have not found any reference on how to do this with busines objects.

I currently have my multiple business objects set up within my VS2005 project with each business object associated with a single Oracle data table from the corporate database.  What do I do next?Hehe

Thanks for any references or examples that you can give me.

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