StrataFrame Forum

Limited Field Set Used In Business Object

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

By Clayton Hoyt - 10/5/2006

Hi Folks

I often have a use for a limited set of fields from a table (i.e., for an employee drop list, I don't need their address, phone, etc. only their ID and Name). How do you recommend doing this? In the past, I have created a function which returns a datatable but then its not strongly typed. I have also used strongly typed datasets but I would rather not use both Strataframe objects and Strongly Typed Datasets so I can keep everything consistant.

Thanks

Clay

By Trent L. Taylor - 10/5/2006

Your select statement in your BO could retrieve whatever limited fields you want and can be accessed through the strong-typed field properties.  The only time you would receive an error is if you attempt to reference one of the strong-typed field properties that was not included in the SELECT:

SELECT my_Field1 FROM MyTable

Valid Reference from select statement above
MyBO.my_Field1

Invalid Reference from select statement above
MyBO.my_Field2 (will produce an error since the field is not in the table)

By Clayton Hoyt - 10/5/2006

That was simple!

Thanks much.

By Trent L. Taylor - 10/5/2006

Sure Wink
By Paul Chase - 10/5/2006

Clay,

I just create a method on the bo and select the fields I need.

Public Sub FillAllCustomerNames()

Me.FillDataTable("Select CustomerName,Cu_id from customer")

End Sub

This does leave the possibility that you can screw up be refencing a field that is on the bo but not contained in the uderlying datatable. This hasnt been an issue for me though.