Ticket Q399649
Visible to All Users
Duplicate

map a stored proc with parameters to a listview

created 13 years ago

I've reviewed this:
http://community.devexpress.com/blogs/garyshort/archive/2010/09/22/xpo-stored-procedure-support-coming-in-v2010-vol-2.aspx
and searched the support portal. But I'm still unclear if, in XAF, I can map a stored procedure that takes one or more parameters to a ListView.
Is this possible?
Can the resulting listview be filtered/grouped/sorted/charted/pivoted just like a normal view?
Do you have any support documents/tickets that illustrate this?
Also, I'm aware of the approach to use a database view with 'Instead of' triggers to allow for updating, but in my situation I cannot access a view directly - I can only access a stored proc - how may I update the database with changes made to the sproc populated ListView?
Thanks,
Chris

Answers

created 13 years ago (modified 4 years ago)

Hi Chris,
If you wish to call your stored procedures (with parameters) directly, you can obtain the result set either as XPDataView or as a collection of non-persistent objects via the ExecXXXIntoObjects wizard-generated method (where XXX is a stored procedure name). Then, you can either manually populate a list view with non-persistent objects (see the How to: Invoke a List View for a Non-Persistent Class article) or create a custom CollectionSourceBase descendant that wraps XPDataView. See XAF - How to show data from Stored Procedures (SP) in a ListView or DetailView using Non-Persistent Objects

To update the database via a stored procedure, create a custom Save action that will execute your procedure via the Session.ExecuteSproc or Session.ExecuteNonQuery method.
See also:
stored procedure in 10.2.2.
Thanks,
Michael.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.