How to truncate data in K2 SmartObjects

  • 18 October 2013
  • 7 replies
  • 2 views

Badge +3

Hi Guys,


Our K2 SmartForms solution UAT will finish soon and now preparing to cleanup the test data but when i tried to delete the data in one of the smartobjects the pirmary key does not reset to 0 or 1.


Is there way to cleanup the test data in smartobjects and reset the primary keys, just like a truncate in SQL or perhaps how to execute the truncate t-sql to cleanup the smartobjects in K2 SQL database.


Please advise.


Thanks


Rupert


 


 


 


 


 


7 replies

Badge +5

Hi Rupert,


If your SmartObject is using SQL Server Svc Obj, you should be able to truncate the SQL table as per your suggestion.


If you are using SmartBox, just delete and re-deploy the SmartObject (from the designers) will achieve the same effect as well.


 


JK.

Badge +3

Hi JK,


Thanks for your reply. Actually these smartobjects was create using SmartBox if i going to delete and redeploy,  will it affect the views attached to these smartobjects?


Also, i just noticed that these smartobjects are in K2SmartBox database, i'm wondering if i can just execute the truncate on these tables? I supposed i should test it, this will be much quicker if this will work unless K2 doesn't support modifying the actual tables in the K2Smartbox database.


Thanks


 

Badge +5

Hi Rupert,


You're welcomed.


As long as you re-deploy the SmartObjects from your Designer (sodx file), the SmartObjects will retain the same GUID and everything will be resume as per normal. Do make a backup of your K2 database(s), just in case =)


Regarding running of the truncate table query directly on the smartbox tables, you may like to check with the K2 Support first.


 


JK

Badge +6

why don't you use 'Delete' method to clear all the data. It is possible to truncate the data directly from the SQL management studio. It will not affect the smartobject or views. However direct database modification is unsupported.

Badge +3

Thanks for our reply. I think i mentioned that the delete method is not option for me as i do not want to retain the identity seed.


The options  i have is to redeploy the smartobjects or truncate the tables in SmartBox database via SSMS. Base on my initial testing the truncate works well.


 


 


 


 


 

Badge +4

@NPS

Can you tell me table names for deletion?

 

Regards,

Asad Naeem

Userlevel 5
Badge +18

The SQL table will usually take on the SmartBox SmartObject name Specified.  


So if a SmartBox SmartObject with name 'Employees' was created; the table in the K2 database would be [dbo].[Employees].


Perhaps doing a select against this table and executing the SmartObject > List method may be a good way to confirm if it is the same entity base on the data returned.

Reply