StrataFrame Forum

returning columns from sql stored sproc not in the business object table

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

By Rick Watson - 1/25/2011

Good morning listers,

We are currently evaluating stratraframe to use as a framework to convert our vfp application. This app has a sql server back end database. Most of our data access is using sprocs. Some of these procedures return columns across multiple tables or aggrigate columns. From the tutorials it looks like strataframe has only one table as the primary business object's data source.

How do we reference columns not in this table returned by a stored procedure?

thanks

rick
By Edhy Rijo - 1/25/2011

Rick Watson (1/25/2011)
How do we reference columns not in this table returned by a stored procedure?

Hi Rick,

Welcome to the forums!!!

You can either create a View and use that as the source table for your Business Object (BO) or if the quantity of fields to be returned by your SP which are not in the primary table of the BO are not much you can create Custom Field Properties in the StrataFrame Business Object to be mapped to those columns, but the simplest way is to create a View for the BO that way the internal Data Table used by the BO will have all the fields returned by your stored procedure.

The StrataFrame Business Objects uses an internal Data Table and the Business Object Mapper (BOM) will create Custom Field Properties for each field in the real table used for the BO, so if the source table is a View then the BOM will do the work for you and create a property for each field in the view which then you can reference in your application using the business object.

Hope this help you clear your question.  Please be sure to invest some time in the documentation in the help file to get familiar with the SF terminology.
By Rick Watson - 1/25/2011

Good morning,

thanks for the reply.

whenever I create custom field properties on the bo, are these visible in the designers or how do they get referenced.

thanks

rick
By Edhy Rijo - 1/25/2011

Rick Watson (1/25/2011)
whenever I create custom field properties on the bo, are these visible in the designers or how do they get referenced.

Yes, you need to rebuild the BO's project so you can see the Custom Field Property (CFP).  For more detail, take a look at the "Adding Custom Field Properties" topic in the help file, also there are plenty of samples in the forum on how to use these.

As anything else there are Pros and Conts on using CFP, but for the most part they will make your life easier as a developer and will help get the most out of StrataFrame. 

I also came from a VFP background and if you read some of my early posts you will see how amaze I was when figuring out how to handle something with StrataFrame.  Some of my applications handle complicated calculations and the use of the SF Business Object in comparison with VFP cursors or temporary table is just great, much easier and with total control of the data by the developer.