How to: using parameterized Views with BO


Author
Message
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
I have the need to grab some records from 3 tables to do a lengthy process which includes looping that resulting query doing some seeks, etc. I am thinking that since this involve 3 tables that I could create a parameterized view in the DDT and then create a BO based on this view, now here is the question: How to fill this BO and pass the parameters to the view?



If you can post a quick seudo code I would really appreciate it, or if it is a better, easier solution that does not required to use a view, I am more than happy to listen. Smile



I am thinking on using a BO to take advantage of the BO features for Seek, Order, etc, since I may need to loop through this data several times.



Thanks!

Edhy Rijo

Peter Jones
Peter Jones
Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Edhy,



I don't use the DDT so I don't know what facilities it offers but, within SQL Server, there is no such thing as a parameterised view. I believe you will be forced to use a stored procedure. However, I do remember seeing references to a creature called an 'inline function' that apparently can operate like an a parameterised view - I guess an inline function may be useful when stored procedures are not an option for some reason.



Cheers, Peter
Peter Jones
Peter Jones
Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Edhy,



Oops, clicked Post too soon.



What you could do is create a view upon which your BO is based but populate the BO using a stored procedure. It does mean you have to keep the view and proc in sync regarding what data columns are returned but I presume the data returned wouldn't change to often (if at all).



Cheers, Peter
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Thanks a lot Peter, I will follow your instructions and test with the View and a Store Procedure with the parameters.

Edhy Rijo

Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Peter Jones (08/04/2009)
What you could do is create a view upon which your BO is based but populate the BO using a stored procedure.


Yeap, you are right, it does work. Besides the possible inconvenience of having to maintain these 2 related objects, in my case the benefits of been able to use a BO to manipulate the data in this process make it worth the downside.



Thanks again for the steps and clarifications.


Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Peter, thanks. Parameterized views were in VFP, but ultimately serve no real purpose since a SPROC is the mecahnism from which this type of this should be done. Glad you got it going.
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