OK, I admit it, I'm defeated. |
Re: Rename an existing attribute AttrDef adOld = find(mod, "MyOldName") AttrDef adNew = modify(adOld, setName, "MyNewName") |
Re: Rename an existing attribute llandale - Tue May 05 09:20:00 EDT 2009 I did find another workaround in the meantime, Just create a 'shadow' attribute of the same underlying type but with the new name, copy accross all the values, delete the original. Simplissimo. If you are wondering why I want to do this, it's because the Word import macro that comes with DOORS (the one that adds an import icon to the word doc) can helpfully import the Word paragraph styles into DOORS, however it puts them into a string attribute called 'Paragraph Style' - however all my modules already have a 'Parargaph Style' enumerated attribute. This is Ok most of the time, but for instance if my word doc has been to france and back (which many of mine do), then 'body text' is now 'corps something-or-other', most annoying. So I have to rename 'my' attribute before import, let the importer do its thing with the string based 'Paragraph Style' attrib, then monkey around with a post processing script to normalise everything afterwards. Fun fun fun. I'll say one thing for DOORS admin work, it never gets boring. |
Re: Rename an existing attribute SystemAdmin - Wed May 06 09:03:45 EDT 2009 Its 'Simplyannoyingo': you have to reinsert the attribute in all the views. I think you should change your 'Paragraph Style' attribute name in your modules and let the importer do its thing. That's sort of a 'system' attr, like 'RTF Header'. >Louie |
Re: Rename an existing attribute llandale - Wed May 06 11:57:48 EDT 2009 Thanks Louie, and yep, I do need to go rename that attribute in my 5,000 or so modules,and then update all teh sctipts that use it, arrrrgh! |
Re: Rename an existing attribute SystemAdmin - Fri May 08 04:47:22 EDT 2009 Turns out searching *.dxl files using Windows Explorer stopped working for me last month. Security here says it wasn't them. Cannot find it on the Windows update site. Anyway, I played with the Registry and figured out how to make it search those files. >Louie |
Re: Rename an existing attribute llandale - Fri May 08 09:17:25 EDT 2009 I usually define my attribute names as strings to use in the programme parts of the dxl - that way its easier to update. |
Re: Rename an existing attribute Ben_Sharples - Mon May 11 01:04:19 EDT 2009 |
Re: Rename an existing attribute llandale - Mon May 11 12:07:18 EDT 2009 I want to rename an attribute, however I also want to update all views which contain the old attribute. I think I have to first rename 'old' attribute to 'new' attribute, then temporarily recreate 'old' attribute to enable me to update any affected views, after which I can delete the temporary 'old' attribute. Or is there a simpler way? |
Re: Rename an existing attribute Martin_Hunter - Thu Apr 17 02:45:00 EDT 2014 I want to rename an attribute, however I also want to update all views which contain the old attribute. I think I have to first rename 'old' attribute to 'new' attribute, then temporarily recreate 'old' attribute to enable me to update any affected views, after which I can delete the temporary 'old' attribute. Or is there a simpler way? I like a template module that you fix; then use script "copyViews.dxl" to push to the rest of the modules. the script "copyAtts.dxl" won't help you rename an attribute. Google those scripts. But if you want a script to fix any particular module, I don't think your approach will work. I think (but not sure) the attr will get removed from some non-displayed view when you rename it and before you have a chance to create the old attr at the same name. I think then you need to plow through all the views and "remember" which view has the old attribute, in which colulmn and other column attributes (width); rename the attr, then plow through the views re-inserting the new. You could also create the new attribute, copy all the values of objects over, then plow through the views changing the column, then delete the old. That will mess up History however; even more so then renaming the attribute. -Louie |
Re: Rename an existing attribute Martin_Hunter - Thu Apr 17 02:45:00 EDT 2014 I want to rename an attribute, however I also want to update all views which contain the old attribute. I think I have to first rename 'old' attribute to 'new' attribute, then temporarily recreate 'old' attribute to enable me to update any affected views, after which I can delete the temporary 'old' attribute. Or is there a simpler way? I like a template module that you fix; then use script "copyViews.dxl" to push to the rest of the modules. the script "copyAtts.dxl" won't help you rename an attribute. Google those scripts. But if you want a script to fix any particular module, I don't think your approach will work. I think (but not sure) the attr will get removed from some non-displayed view when you rename it and before you have a chance to create the old attr at the same name. I think then you need to plow through all the views and "remember" which view has the old attribute, in which colulmn and other column attributes (width); rename the attr, then plow through the views re-inserting the new. You could also create the new attribute, copy all the values of objects over, then plow through the views changing the column, then delete the old. That will mess up History however; even more so then renaming the attribute. -Louie |
Re: Rename an existing attribute llandale - Wed May 06 11:57:48 EDT 2009 Hi, i had a similar issue where i had to rename a number of attributes that were all used in multiple views. Luckily the change impacted only a few modules. I worked around the issue by: Creating a dummy attribute For the attribute to be renamed find the views and the related columns where it is used For those columns replace the attribute with the dummy attribute Save the view Rename the attribute For those columns replace the dummy attribute with the renamed attribute Save the view Not very elegant but it worked for me. I have attached the file for reference
Attachments Teds Toy Box.zip |
Re: Rename an existing attribute ChrisHardy68 - Thu Mar 12 17:33:53 EDT 2015 Hi, i had a similar issue where i had to rename a number of attributes that were all used in multiple views. Luckily the change impacted only a few modules. I worked around the issue by: Creating a dummy attribute For the attribute to be renamed find the views and the related columns where it is used For those columns replace the attribute with the dummy attribute Save the view Rename the attribute For those columns replace the dummy attribute with the renamed attribute Save the view Not very elegant but it worked for me. I have attached the file for reference
Hello ChrisHardy,
I try to rename some attributes in several modules. I 've tested your code Teds Toy Box and it is really helpfull for me. How can I improve it to be able to run this code on several modules ? I have some problems with the dialog box : I cannot have any code after the show command, so I can't make a for loop ...
THank's for your help |