Skip to main content


 

Symptoms

 


When trying to create new SmartObject from a SQL Stored Procedure in K2 blackpearl 4.6.7 and 4.6.8 the following error message appears: rStored_Procedure_Name] contains a Property with the same name 'Column_name'. 

 

 

 

11435i8748CD3987654385.png

 


Diagnoses

 

 

 

The Stored Procedure looks like a simple IF/ELSE statement that outputs either all or some columns:
 

 

15448iFDFA6EBE754277F8.png

 

 

 

This happens when a duplicate property is created. Then the property name does not get differentiated by implementing an incremental value. In other words IF and ELSE statements SELECT the same columns.

 

 

 

Resolution

There is no fix for that, but currently the item is being worked on for 4.7.0. With that being said there are two workarounds. One being inserting the data into a table variable and querying the table variable:

 

 

 

12081i1000A692EE7D8099.png

 

 

 

Another one is inserting extra code underneath the AS keyword after variables are declared as shown below:
 

 

13973i0FB7B1FD3227A965.png

 

 



 

Th eeasiest way is to 

  1. remove the else statement
  2. register the smartobject 
  3. replace the else statement (or any other changes as long as the return columns won't change).

By Setting the FMTONLY OFF and the NOCOUNT ON and moving directly under the "AS" with any variable declarations I avoided the "Column1" "Column1" problem.

e.g.

 

ALTER PROCEDURE External]..AutoProcess] (@ExternalProcessingID as bigint)

AS

SET NOCOUNT ON;
SET FMTONLY OFF;

Declare @DeviceDrugID bigint
Declare @ExternalGeneralID bigint
Declare @spreturn_value bigint
Declare @DBOGeneralIDValue bigint
Declare @CreatedBy varchar(100)
Declare @CreatedByDisplayName varchar(150)
Declare @CreatedDate datetime

BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
BEGIN TRY
BEGIN TRANSACTION


Reply