How to show stored procedure based List methods in an Item View method rule action

  • 15 February 2022
  • 0 replies
  • 228 views

Badge +6
 

How to show stored procedure based List methods in an Item View method rule action

KB001455

PRODUCT
K2 smartforms 1.0 to 4.6.10
BASED ON
K2 smartforms 1.0
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

 

Audience
  • Developers
  • View Designers
Required Knowledge
  • SmartObjects
  • SQL Server Service Instance
  • Views
  • Rules

Introduction

The latest How To topics are available in the K2 Five User Guide or the K2 Cloud User Guide’s How to section.
In the SQL Server Service, when a stored procedure returns a result the Service Object method would be a 'List' type. When mapping a SmartObject method to this Service Object method, the SmartObject method will automatically be created as a 'List' type method. SmartObject List type methods are not shown in the Item View, only Create, Read, Update and Delete methods. A workaround for this behavior would be to change the SmartObject method to a 'Read' type. When changing the method type to Read, only the first row of the results will be returned.

 

 

Example Scenario

In the scenario below we will use the [dbo.].[GetProduct] SQL Service Instance based SmartObject to show how a stored procedure based method can be made visible in the list of methods used for the Execute a method on the View rule action of an Item View. The purpose is for the Item View to have the ability to surface custom List methods in the Execute a method on the View rule action.

The scenario doesn't cover the creation of the [dbo.].[GetProduct] SmartObject as it is assumed that the user has the relevant knowledge on creating a SQL Server Service Instance based SmartObject.

The scenario starts where an Item View is created based on the [dbo.].[GetProduct] SmartObject.

Follow the steps below to set up the scenario:

  1. Create an Item View using the [dbo.].[GetProduct] SmartObject which should be available under the Default folder of the category tree.
  2. Configure the Layout step as required then proceed to the Rules step of the wizard.
  3. Add a rule using the Execute a method on the View rule action.
  4. Note that the 'List' method is not displayed in the list of methods available.
    Image
  5. Edit the [dbo.].[GetProduct] SmartObject.
  6. Click on the Methods tabs on the Define Properties & Methods screen.
  7. The List method is displayed.
    Image
  8. Edit the List method and select 'Read' as the type then change the name of the method to Read. Click Finish and save the SmartObject.
    Image
  9. Edit the View and navigate to the Rules step.
  10. Add a rule using the Execute a method on the View rule action.
  11. Note that the 'Read' method is now displayed in the list of methods available.
    Image

 


0 replies

Be the first to reply!

Reply