8 Replies Latest reply on Sep 9, 2015 6:58 AM by jnfortney

    String Max. Length

    Apprentice

      I'm embarrassed to ask this, but I cannot find it anywhere...


      Is there a way to change the max. length of a string attribute?


      Thanks!

        • 1. Re: String Max. Length
          elizabethcombrink Employee

          Hiya - you set it in object designer when you create an attribute.  Once you save the attribute, you can not change this value through Console though. Some data manipulation is needed if you really need to change the size.

           

          If you are still in development stage, delete all data from the field by running sql script, and then delete the attribute from the object, and recreate it.

          • 2. Re: String Max. Length
            Apprentice

            Thanks Elizabeth.  I do know how to set it at the time of the Attribute creation, but we ran into several that were too short.

             

            Could you elaborate on the "data manipulation" that is needed to change the size?  Also, which SQL script are you referring to in order to delete it?

             

            Thanks again!

            • 3. Re: String Max. Length
              elizabethcombrink Employee

              I changed the size by updating the metadata in the database (it was my usr_cicategory value)

               

              --- to see how large the app thinks is is

              select md_title,md_max_length from md_attribute_type where md_database_table_guid IN(
                   select md_guid from md_database_table where md_name = 'usr_cicategory') and
              md_name = '_Name'


              -- to update the value to 64

              Update md_attribute_type
              set md_max_length = 64
              where md_database_table_guid IN(
                   select md_guid from md_database_table where md_name = 'usr_cicategory') and
              md_name = '_Name'

               

              --to change the value in the database as well

              alter table usr_cicategory alter column usr_name varchar(64) null

               

              And then the attribute on the window needed to be replaced to pick up the new size.

               

              I also would have done an IISreset

               

              Now the caveat as with everything you do by manual manipulation of the database - Test this properly in a test environment, and take a backup of your database before implementing in live.

              1 of 1 people found this helpful
              • 4. Re: String Max. Length
                elizabethcombrink Employee

                Oh sorry, you had a question about script to clear the data - it would be an update statement - which can be simple or not depending on what it is that you want to clear.  You need to set the value to null before it will allow you to delete the attribute in object designer.

                 

                 

                 

                update

                 

                TABLENAME

                set

                 

                ATTRIBUTE = null

                where

                not

                 

                not

                not

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                ATTRIBUTE is null

                 

                SQL skills are always a good thing when trying to do stuff with this app :-)

                1 of 1 people found this helpful
                • 5. Re: String Max. Length
                  Apprentice

                  It worked.  Thank you Elizabeth!

                  • 6. Re: String Max. Length
                    Apprentice

                    Sorry to bump this after this length, but Elizabeth, would the script you used to update the Maximum Length in theory allow you to update the length of the attribute whilst the data in the attribute remains safe? Obviously it would only work if you're increasing the size, but could you get away without deleting the data first?

                     

                    Many Thanks,

                     

                    Anthony Mitchell

                    • 7. Re: String Max. Length
                      elizabethcombrink Employee

                      I can confirm I did this without deleting the data first - I enlarged the field.  I did have to readd the attribute to the windows for it to allow me to enter a larger value on the window..

                       

                      Once again, if you have to go down this route, make sure you test it through on a test database, including doing a MDM afterwards so that you know your upgrade path going forward is not corrupted

                      • 8. Re: String Max. Length
                        jnfortney Specialist

                        Sorry to pile on to a very old thread.  We're running into an issue with some of our support groups wherein I need to increase the length of the title available on Web Access dashboard process links.  Given the current number of shortcuts it's not practical to create a new attribute and delete the old one (if this is even possible on this attribute).  I made the update suggested in this article to the md_attribute_type table and altered the ui_shortcut_item field to increase the Title size from 64 to 128.  Running the MDM resets the length to 64 as expected, but once data have been entered that exceed this length the MDM fails with a "String or binary data would be truncated. The statement has been terminated." fatal error.  I'm guessing there's no solution to this other than "don't do it" since it's not a recommended or supported change.  I need the longer Title size, but I can't corrupt the database or break our ability to upgrade in the future.  BTW we're running 7.8.1.  Thanks!