Changing field types for a Smart Object property
I understand that a smart object maps to a table in the smartbox database, and that you can't just change a field (column) type without messing up existing data, but what if I don't have any data in the smartbox? I'd expect a warning that data would be lost, and then possibly an alter table script to change the column type in the smartbox database the smart object maps to?
As it stands at the moment, Visual Studio crashes and dies as soon as I change the field type in the smart object even before I save the it (i.e. long before I can even deploy it) so I'm stuck. In a development environment where these things are changing along with requirements I'm finding this a tad limiting...
Any ideas?
tbyrne:Quick question - are you using SP1? If so, were the SmartObjects originally created in a previous version?
Good question - should have mentioned that. I am using SP1 and the smart object was created in SP1 (this morning using the same VPC).
I have tried changing text to number and also text to memo - both crashed.
I will try to figure out why it's crashing here before I take it further then - thanks for the help!
Trentino
I see two issues here.
1. Visual Studio Crashing.
Do you happen to have .NET Framework 2.0 SP1 installed? There was some issues with this SmartObject edit dialog with this framework serivice pack. A hot fix was just release for this. For more information please refer to: http://kb.k2workflow.com/Articles/KB000201.aspx
2. Changing Data Type.
SmartBox will not permit changing of data type once data exists in the underlying table. You should receive a compile time error similar to this if you make a change and then compile:
"Deploy smartobjects: Task error: SmartObjectServer Exception: Could not publish SmartObjectDefinition to server: Error: Cannot update the object definition.Cannot change the type of property "StoreName" from Text to Number. Data already exist for the object.[]"
I would recommend trying the following:
1. Backup the SmartBox SQL database
2. Within SQL Server copy/extract all the all data from this underlying SmartBox table (the table name should match you smartobject name)
3. Delete all records from this table
4. Make change in your SmartObject definition and deploy.
5. Copy data back into this table from the copied data, taking into account the data type change.
I would recommend creating a test SmartObject to try this out on before attempting on a real one in order to refine your steps/scripts.
HTH.
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.