Skip to main content

If i have a form with 10 fields and have already had users send in requests and now have records saved in the Smartobject, what happens if i want to add another field?

 

Does adding a new field mess up any form - smartobject relationships?

 

Can i delete a field (already used in a record) and then re-create it using the same name but a different Datatype (i.e. was text, now memo) and will that still allow me to retain the existing records?

 

Thanks for any advice.

Hi Sharpharp1

 

You mention a few scenarios in your post. 

 

Does adding a new field mess up any form - smartobject relationships?

 

No, adding a new fields should not affect your form/views or any smartobject relationships. You can simply add the new property as a control on your forms/views/

 

Can i delete a field (already used in a record) and then re-create it using the same name but a different Datatype (i.e. was text, now memo) and will that still allow me to retain the existing records?

 

This depends on what you actually are doing. If for example you are using Smartbox and you delete and recreate a field with a different data type then in the background K2 will create another table field, so you will lose access to any existing data. In this case if you need access to the data then I suggest leaving the field and creating your new one (with a different name)

 

If you are using an advanced smartobject (e.g. SQL) then you can delete and re-add properties, but you will need to manually map them to the service instance property in your methods. So if they are mapped to the same service instance property you will have the same data. If you re-name the property you will need modify any controls on views/forms to remap them to your new property.


Thanks Andrew,

 

I have also changed the name of a field in the Smartobject, but it doesn't change the name in the SQL table.... Any ideas why?

It is a smartbox object.

 

 


Changing a Smartbox smartobject property name (after the smartobject has been created) will not update the underlying database table column name. I can't give you the definitive reason for this, except to say that there really is no need to. You can change the property name for any smartobject without having to worry about renaming the "field" name in any underlying data source. Smartobjects are simply a mapping to one or more Service Instance methods. The Smartobject knows nothing about the underlying data sources (e.g. SQL, Web Service, etc) - it hands this off to the service instance/s that the methods use.


Hi Andrew,

 

What if you want to do reports based on the SQL tables? Not having the correct names on the tables will provide inconsistancies.

 

Why doesnt't renaming field in SMO not update the Smartbox SQL fields? Surely, this should come like this out of the box???


Hi Sharpharp1

 

Given that this is Smartbox, you should not be reporting directly against the K2 database, but using the smartobject layer as a datasource for any reports. As such it doesn't matter what the DB field name is, you only need to know what the SmartObject property name is.

 

I don't know the full reason why the DB is not updated, but my best guess is that renaming database fields after they are created can be problematic, and as it is not really necessary avoiding it avoids any unexpected SQL errors. 

 

Just remember Smartbox is supposed to be a quick and easy way of creating data storage in K2, and the backend tables it uses (i.e. K2 database) should not be a concern for the user. In fact that is one of the benefits of Smartbox, you don't need to do any work in SQL, and you don't need to care what happens in SQL - it just works.


Reply