Skip to main content

I have created a smartobject (smartbox) and now I want to delete all the data stored in the smartObject because there are a lot of test data inside.
Is this possible through k2 workspace?
What's the best way to delete the data. Should I designe a new process which deletes the data from the SO?

Thanks

There are several ways to approach this. 


If you want to delete the data outside of a workflow at design time, you could just use SQL Management Studio and go to the K2 SmartBox database table that holds your data and delete all the rows.  You could also download a tool like K2 Commander from blackmarket to do this.  http://www.k2underground.com/k2/ProjectHome.aspx?ProjectID=39


If you want to delete the data at runtime, you could use the SmartObject event in an iteration similar to this post:


http://www.k2underground.com/forums/post/25500.aspx


Hi there,

 

I am trying to do something similar, I want to clear the records and PDFS which are created when using the PDF File SmartObject is used, otherwise the database will fill up.

 

The links in the above post are no longer working, any ideas?

 

 


Hi Jochen


 


Try these three options:


Option 1


I agree with DavidL, the best option to delete all or some data from a SmartObject would be to do the following:


1. Open SQL Management Studio


2. Expand Databases > K2 > Tables > Navigate to the SmartObject


3. Right Click on the SmartObject and Select Edit top 200 Rows


4. Here you can select the items you want to delete from the smartobject by using shift and click to select multiple items


5. When the items are selected right click then select delete (this will delete all the selected records)


 


Option 2


If you want to detlete everything in the smartobject, you can also delete the entire smartobject and just recreate the smartobject with the exact same properties,data types and smartobject name, as this new smartobject will then retake the old smartobjects place (Note even thou deleting the entire smartobject and recreating it will work, I prefer you use the first option to delete the items from the smartobject rather that the entire smartobject as this is not completely advisable).


 


Option 3


Delete the records using K2 Designer or SmartObject Tester Tool (Note this will only allow you to delete single items from the SmartObject one at a time but is considired Best Practice).


Raymond,

 

Firstly, just wanted to say your replies have always been spot on, for a newbie like me , your're simplistic explanations are brilliant, I really appreciate it.

 

Question, the Smartobject I am editing is the PDF File -dbo when i delete a row, will it actually delete the generated PDF File itself or is that stored elsewhere? The reason for doing all this is to keep storage space down by deleting any PDFs generated via the PDF Control.

 

Hope that makes sense, I kinda feel like i'm making some progress on this with your help.

 

Thanks again.


11456i21251F5DA9E79E5F.jpg

Now if I run the form and do SAVE, it won't let me make a PDF, it gives error "the PDF could not be saved". By deleting the row has this messed things up?


Hi Sharpsharp1


 


This error only occurs when the PDFFile SmartObject is removed - as there is no place to save the PDF's to.


 


Please do the following for me in this order:


1. Open SQL Management Studio


2. Expand databases > K2 > Tables > Search for dbo.PDFFile


3. If the dbo.PDFFile is not found in the K2 Tables, then create it as follows. Otherwise if the dbo.PDFFile is still present and the error is also still present then delete the PDFFile Table and do the following steps.


4. Navigate to the expanded databases > K2 > Tables > Right click on Tables > Select New Table


5. Configure the Table exactly as this image states.



14583i0B6081D5B3C1F405.png



6. Click Save Button and refresh the Databases


7. Go back to K2 Designer and test your Process, It should be working as it did.


 


In the Future I suggest that you rather use Option 3 mentioned earlier as this is considired as best practice even thou it takes a little more time before trying to delete the records from the smartobject (Previous Post Option 1) and before deleting the entire smartobject. Deleting the smartobject will work but it is not highly recomended especially if the SmartObjects has dependancies (Previous Post Option 2).


 


Yes when deleting the record from the PDFFile smartobject the whole pdf the was generated is deleted and is not stored else where, depending on how you constructed your rules in the view.


 





Raymond,

 

I 100% used Option 1, i simply deleted one row to test it, and then when i ran my form again, that is when i got the error.

 

When i went back into SQL studio, dbo.PDFFile was 100% still there (i know because I did not delete it).

 

I have followed your pic and deleted the table and re-created it using SQL Studio. I then created a form, added the save to pdf control and tried, but its giving the same error.... "The PDF could not be saved."


Hi Sharpsharp1


 


When deleting 1 or multiple record from any smartobject like Option 1 suggested, only removes the record it does not have anything to do with how the records are save to the smartobject, etc. But I have taken the exact same steps that you took as a test on my side and on my enviroment everything worked as expected. So the fact that you recieve this error after following Option 1is very weird.


 


Please attach these 3 screenshots for me:


screenshot of the error


screenshot of the rule construction that you used on to call the save to pdf control


screenshot of the used view that has the pdf control on - please take this screenshot in edit view mode


Reply