StrataFrame Forum

BO's and Stored Procedures

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

By Terry Bottorff - 4/3/2009

I have a Stored Proc that combines 2 Tables into one table (Like a Name Table and a Score Table) related by a NamePK to get a table that contains the names and respective scores. How do I attach this stored proc to a BO?

I have tried searching the forum and I can fill a BO if it is just a single table with a stored proc but with multiple tables I am not sure how to do that so the BO will know the structure of the resulting table?

TIA.

By Edhy Rijo - 4/3/2009

Hi Terry,

Check out this post http://forum.strataframe.net/Topic21580-8-1.aspx it will explain how to do what you want.
By Michel Levy - 4/3/2009

Hi Terry,

2 solutions, that I use in an app:

  1. create a view as SELECT * from <your SP>, and map your BO on that view
  2. create a table, let it empty (no data), map your BO on that table, and from within the BO, ExecuteNonQuery('your_SP'). Of course your SP need to delete all in the table, and then fill the table. You can now fill the BO from the table.

It woud be great if we could map a BO on a table function...

By Edhy Rijo - 4/3/2009

Hi Michael / Terry,

If you are using the DDT, you can create a table schema with all the columns that you want, then map the BO in the BOM to that table schema and then you can use your store procedure to fill that BO, as long as your SP return columns with the same names mapped in the BO you will be OK.



Also if you already have a BO created with some some columns, you can add the needed columns as custom fields properties with the same names as the columns returned by your SP and the BO will also fill up those custom field properties for you.
By Charles R Hankey - 4/3/2009

Edhy - if you create a structure like that in DDT (interesting idea) do you let the DDT deploy the structure to a table in the database? Is this for a basically readonly BO? Not sure how the update would work -are you just updating the primary table that fills the BO, as you would with a VFP remote view?
By Edhy Rijo - 4/3/2009

Hi Charles,



Yes I use this procedure for ReadOnly process where I like to use the SF ListView and also for XML files, this way instead of me maintaining the XML fields manually I simply use a dummy DDT profile and tell the BOM to use that DDT profile to build the BO schema. All this is explained in more detail in the link I provided in this thread before.
By Charles R Hankey - 4/3/2009

Thanks. Maybe I'm doing something wrong but that link just takes me back to this page Unsure
By Terry Bottorff - 4/4/2009

The link did the same to me and I finally had to copy and paste it to make it work.