Changing Field Types

SOLVED

I currently have a field type of selection, which only allows you to select one item in the list. Would it be possible to change the type selection to type multiselection? There's already information in the old field and I really would like to not abandon that information (or maybe is there a way to create the new multiselect field and populate it with the old select information for each record?)

Parents
  • 0

    Well, it looks like I just updated the field with the information

    UPDATE Custom_Edits

    SET ColP_EntryType = 28, ColP_EntrySize = 5, ColP_DataSize = 255

    WHERE ColP_ColPropsId = '11594'

    It worked when I tried to create a new opportunity, and then worked again when I tried to modify an old field (click the change button and then multi-select).

    I haven't done the update to add the commas, are you sure it's necessary?

    ALSO!

    When I try

    UPDATE Opportunity
    SET oppo_asstech2 = ','&oppo_asstech2&','
    WHERE oppo_asstech2 IS NOT NULL

    I get an error: "The data types varchar and nvarchar are incompatible in the '&' operator. So I tried:

    UPDATE Opportunity
    SET oppo_asstech2 = ','+oppo_asstech2+','
    WHERE oppo_asstech2 IS NOT NULL


    And I get "String or Binary data would be truncated. The statement has been terminated."

  • +1 in reply to Tebasaki
    verified answer

    Hi,

    as I've used your post to find the solution, please let me give two major updates for this script that are missing in your post in order to avoid any issue if someone follow exactly what you have done :

    1) your script changes the field for the metadata but does not consider the real database field size, so it is required otherwise a user that would select multiple values up to 31 char will generate an SQL exception when saving the record.

    In your example :

    ALTER TABLE [Opportunity]
    ALTER COLUMN [oppo_asstech2] nvarchar(255) 

    2) if the field is followed by the tracking engine of the entity to be modified, just like opportunity in your example could be tracked by OpportunityProgress entity, the same field in the "progress" entity (and its content) must be updated too.

Reply
  • +1 in reply to Tebasaki
    verified answer

    Hi,

    as I've used your post to find the solution, please let me give two major updates for this script that are missing in your post in order to avoid any issue if someone follow exactly what you have done :

    1) your script changes the field for the metadata but does not consider the real database field size, so it is required otherwise a user that would select multiple values up to 31 char will generate an SQL exception when saving the record.

    In your example :

    ALTER TABLE [Opportunity]
    ALTER COLUMN [oppo_asstech2] nvarchar(255) 

    2) if the field is followed by the tracking engine of the entity to be modified, just like opportunity in your example could be tracked by OpportunityProgress entity, the same field in the "progress" entity (and its content) must be updated too.

Children
No Data