Skip to main content

Hi,

 

I created a basic table in a dev environment and linked a smartobject from it (Made the SQL table a smartobject in essence). My issue that I am running into is that i am not getting any methods when i am going to create a view from the smartobject. I am not sure if it is permissions issue or what, but i gave the k2service account dbowner permissions.

 

Can anyone help me out? See attached screenshots.

 

Thanks!


11529iBABEF5E2F28976DF.png
12427iDFFC3FC396BC8319.png

Hi Scott,

 

Without seeing the steps to configure the smartObject, The problem may exist in the actual creation of that object.  Creating an object in K2 Studio typically will not create appropriate SQL methods on it's own. (with the exception of using the Smartobject Service Tester)

 

By default, when you go to create a new SmartObject, K2 Studio assumes a SmartBox object is being created.  We need to delete the smartBox methods and add our own:

 

15645i2CA9B978D03F1E96.png

 

Once I click remove all, it clears the methods listed in the bottom right, and we can begin adding new ones by clicking the Add button to the left of "Remove All"

 

Moving through the wizard, I'm creating a list method for my list (of potatoes).

 

15291iC541A534F8F06789.png

 

Now, we drag the service object method from the context browser for the appropriate command (List in this case), and ensure all the settings are as they need to be.  I hit create all to map the fields in this case, depending on your implementation, you may want to do this manually.

 

14230i5F69EDD6CC9A7BD7.png

 

And the next step finishes the wizard.  From there, you've created a list method.  You'll want to repeat this for create, delete, read, and update, as needed.

 

With the service object tester, you have little control over the process, but you can use that to autogenerate a SmartObject for testing purposes by right clicking the table.

 

17150i85EC60473A9EC2CD.png

 

Now, if you already have created these and the issue persists, I'll need some more details as far as how the smartobject is currently configured and what methods are set up.


If anyone runs into this in the future. 


 


 It’s outlined in this help documentation:


 


https://www.k2.com/helppages/k2blackpearluserguide4.6.7/webframe.html#tables.html


 


The script (WithCRUD]) from that help doc and was able to extract all methods.


 


CREATE TABLE Tdbo].LWithCRUD](


     

      bDescription] Ânvarchar](50) NOT NULL,


      nvarchar](max) NULL,


      NIntValue] rint] NULL,


CONSTRAINT nPK_WithCRUD] PRIMARY KEY CLUSTERED


(


     

)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON SPRIMARY]


) ON  PRIMARY]


It seems that question has been answered but just wanted to add some relevant information here. First just a quote from K2 documentation:


 


 


"All the CRUD (CREATE, READ, UPDATE, DELETE) methods including LIST will only be created as Service Object methods if there is a primary key on the table. If there is no primary key on the table only a List method will be created." (source)


 


Also another thing to keep in mind is that you should not use dot in your table name, otherwise only Read method will be exposed by SMO created from this table. The other day I spent loads of time trying to figure out why I have only Read method exposed by my SMO until I find out that it was down to dot in source table name. 


Dear Mikhail,

 

Its regarding your second point "don’t use .(Dot) while creating the table"

 

Can i know how exactly we are not supposed to use?

 

Thanks for sharing more details.

 

Regards

Srinivas Kondapalli


Hi @Amar,


 


There is a known issue which exist since 4.6.7 at least and up to latest versions - when you create table in SQL database which contains dot symbol in table name and then create SQL Server SMO based on this table only List method will be exposed for this SMO. So if you create table named "Source.Table" you will get only List method in SMO based on this table, but once you rename it into "SourceTable" (without dot) it will expose CRUD methods. Dot between schema name and table name doesn't have any impact here - we speaking about table name only. So "Dbo.SourceTable" (where "Dbo" is schema name) will expose CRUD methods without any issues.


Life saver of week award goes to Mikhail!!

Reply