Skip to main content

Hi all,


I'm new on the K2 world and I have a problem with SmartObjects and editing data programmatically.
When I want clear the field value of a SmartObject, so set a NULL value or an empty string, it does not seem to work: the field is not cleared.


 I've tried with these three ways:




  • mySmo.Propertiess"fieldName"].Clear();



  • mySmo.Propertiess"fieldName"].Value = string.Empty;



  • mySmo.Propertiess"fieldName"].Value = null;


Can someone help me ?

Thank you.
Hi Mike,

A very quick background on SmartObjects:
SmartObjects rely on an underlying Service implementation (code) which determines what functionality is available. The default Service Used by SmartObjects when using the SmartObject designer is SmartBox. SmartBox will as you have seen create a SQL table for each SmartObject you create in the SmartBox database which K2 Creates on install and provide methods for create, save, delete and get list.

The reason that I am explaining this is that the ability to null your back end data depends on how the underlying service implementation manages this for SmartBox you can pass a string value of SCNULL, for other services this may be different.

HTH

Murph

Thanks for the response.


So yes, I use the SmartBox Service.
What is SCNULL ? Should I do this: mySmo.Properties["fieldName"].Value = "SCNULL"; ?


It doesn't work, I don't see how I can do this.


Anyone can help me ?


Reply