COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Framework Manager => Topic started by: shawnzhao123 on 13 Jan 2011 05:46:03 PM

Title: Easy way to update a lot of query item names?
Post by: shawnzhao123 on 13 Jan 2011 05:46:03 PM

Is there a way to update a lot of query item names without manually change them one by one?
My table column names are following name standard like: name_1 ..... name_500
I want to update these columns to meaningful names that user can understand, which I already had them in an excel file like this:
name_1      name string 1
name_2     name string 2
.
.
.
name_500    name string 500

Any helps will be appreciated? thanks

Shawn
Title: Re: Easy way to update a lot of query item names?
Post by: cognostechie on 13 Jan 2011 11:31:39 PM
Do it at your own risk !

Open model.xml file in Notepad and do a search and replace.
Title: Re: Easy way to update a lot of query item names?
Post by: blom0344 on 14 Jan 2011 02:54:17 AM
This is really quite a bit more tricky than doing a simple search and replace. You actually need to know which part of the xml needs updating. For instance if you have a model query subject that references a sql query subject, you may need/want to update only the former. So the best approach is to :

1. copy the model.xml as  model_old.xml
2. Change one data item through FM manager
3. Compare both  .xml files to check WHERE changes are applied

Everything - as mentioned - at your own risk!!
Title: Re: Easy way to update a lot of query item names?
Post by: MFGF on 14 Jan 2011 03:15:24 AM
One other solution is to use the multilingual support features to do this.  If your model currently uses a single language (eg en), add a second language to the model (such as en-nz), then use the 'export language file' option.  This will create a text file with two columns of data - one for en and one for en-nz.

Edit the text file and replace all the names in the 'en' column with your meaningful names (or cut and paste the data from your existing excel file, making sure that the original names are in the en-nz column and the meaningful names are in the 'en' column.

Finally, import the language file, converting from en-nz to en, and all the item names should get updated in one hit.

Regards,

MF.
Title: Re: Easy way to update a lot of query item names?
Post by: shawnzhao123 on 14 Jan 2011 12:34:18 PM
Thank you all. It works for exporting and importing the languages.
Title: Re: Easy way to update a lot of query item names?
Post by: RobsWalker68 on 18 Jan 2011 01:20:53 PM
Nice solution MF.

I really like that and one I am going to add to my bag of tricks.  It's the kind of solution I could role out in front of a client and make myself look more intelligent than i actually am!

Cheers

Rob
Title: Re: Easy way to update a lot of query item names?
Post by: eliza_jane on 19 Jan 2011 01:16:40 AM
Hey MF, that was a cool out-of-the-box solution. Great work.
Title: Re: Easy way to update a lot of query item names?
Post by: MFGF on 19 Jan 2011 06:44:54 AM
Thanks to both of you for the kind words! :)
Title: Re: Easy way to update a lot of query item names?
Post by: FM on 22 Jan 2011 04:54:34 AM
Ok, why do this? AS MFGF notes, it is dangerous. You could end up changing something you shouldn't have. Plus, Framework Manager has this capability built in!

Open you model, and on the right you have the Summary/Search/Dependencies Tab.
Choose search, and you find an advanced search capability that lets you pick in what part of the model you want to limit your search (for example, only the Transformation Layer...), you can search by class (object name, table name, namespace and so on), you can search with capabilities such as:
and of course, it contains a bulk replace. I also use it sometimes to select many object at once if need be. Very useful capability which saves loads of time in modeling.
Title: Re: Easy way to update a lot of query item names?
Post by: Yunus on 15 Feb 2011 08:01:29 AM
For adding hundreds of security groups to a model I used a program called Advanced Find and Replace 5.  It has "cyclic" find and replace.  Using your excel spreadsheet it could automatically go in and change A to B and then on the next one change A to C or whatever you want based on your spreadsheet.