In my last blog, I explained all the steps to automate the folder(table) name change in catalog file by using XML Search and Replace.
Now, lets thinks about the complex scenrio where you have sizeable changes in your catalog files and you want to automate this by writing a script. Also, the first option does not give feature to change the specific objects like "Folder name/Formula, Subject Area" only.
Here is the sample XML file.
<?xml version="1.0" encoding="utf-8"?>
<actions>
<action command="textReplace" oldValue="paint" newValue="HoleyShoes" ignoreCase="true"/>
<action command="renameSubjectArea" oldValue="SnowflakeSales" newValue="GG SALES" ignoreCase="false"/>
<action command="renameTable" subjectArea="Paint Exec" oldValue="forecast measures" newValue="GGFCMEASURES" ignoreCase="true"/>
<action command="renameColumn" oldValue="CategoryID" newValue="GG CATID" ignoreCase="false"/>
<action command="renameFormula" oldValue=""Paint Exec".Measures."Year Ago Dollars"" newValue=""Paint Exec".Measures."GG YAGODOLLARS"" ignoreCase="false"/>
<action command="renameFormula" subjectArea=""Paint Exec"" oldValue=""Products".Brand" newValue="GGPRODUCTS."GG BRAND"" ignoreCase="false"/>
</actions>
Example :-
1. Rename the catalog files where Actual Revenue $ is used with Actual Revenue #. (textReplace)
2. Renaming entire subject area from Sample Sales Lite to Sample Sales Lite Version (renameSubjectArea)
3. Rename the files where presentation layer table "Calculated Facts" is used with "Calculated Measures" (renameTable)
4. Rename the files where presentation layer column "Discount Amount" is used with "Discount Amount_1".
Create a new XML file with below syntax. Save it and provide this file as a reference under catalog manager XML Find and Replace utiltiy.
<?xml version="1.0" encoding="utf-8"?>
<actions>
<action command="textReplace" oldValue="Actual Revenue $" newValue="Actual Revenue #" ignoreCase="true"/>
<action command="renameSubjectArea" oldValue="Sample Sales Lite" newValue="Sample Sales Lite Version" ignoreCase="false"/>
<action command="renameTable" subjectArea="Sample Sales Lite" oldValue="Calculated Facts" newValue="Calculated Measures" ignoreCase="true"/>
<action command="renameColumn" oldValue="Discount Amount" newValue="Discount Amount_1" ignoreCase="false"/>
</actions>
Open Catalog manager and perform XML Search and Replace by providing the xml file reference as show below.
We can see the changes after run is completed in the results window.
Now, deploy the changed RPD and restart services. You can see all the changes are reflected in presentation catalog. No impact on the saved reports/analysis.
Similarly, you can use renameFormula option to update specific column formula in the catalog. This may be necessary sometimes as all the calculations may not be directly fetched from repository.
<action command="renameFormula" oldValue=""Sample Sale".Measures."Year Ago Dollars"" newValue=""Sample Sales".Measures."GG YAGODOLLARS"" ignoreCase="false"/>
<action command="renameFormula" subjectArea=""Sample Sales"" oldValue=""Products".Brand" newValue="GGPRODUCTS."GG BRAND"" ignoreCase="false"/>
Remember, dont forget to take backup of originial files.
Cheers...
Now, lets thinks about the complex scenrio where you have sizeable changes in your catalog files and you want to automate this by writing a script. Also, the first option does not give feature to change the specific objects like "Folder name/Formula, Subject Area" only.
Option 2 :- Use "Import from File"
This options has extra features like changing specific part of the report XML code.Here is the sample XML file.
<?xml version="1.0" encoding="utf-8"?>
<actions>
<action command="textReplace" oldValue="paint" newValue="HoleyShoes" ignoreCase="true"/>
<action command="renameSubjectArea" oldValue="SnowflakeSales" newValue="GG SALES" ignoreCase="false"/>
<action command="renameTable" subjectArea="Paint Exec" oldValue="forecast measures" newValue="GGFCMEASURES" ignoreCase="true"/>
<action command="renameColumn" oldValue="CategoryID" newValue="GG CATID" ignoreCase="false"/>
<action command="renameFormula" oldValue=""Paint Exec".Measures."Year Ago Dollars"" newValue=""Paint Exec".Measures."GG YAGODOLLARS"" ignoreCase="false"/>
<action command="renameFormula" subjectArea=""Paint Exec"" oldValue=""Products".Brand" newValue="GGPRODUCTS."GG BRAND"" ignoreCase="false"/>
</actions>
- textReplace :- will perform blind search/replace and change every context where the specific text is used. Similart to basic option -1. Be careful while using this option.
- renameSubjectArea :- This will change only the subject area name from the catalog XMLs.
- renameTable :- This will change the Table name of the presentation layer (folder).
- renameColumn :- This will update presentation column name of the folder.
- renameFormula :- This option will update formulas applied in the criteria.
Example :-
1. Rename the catalog files where Actual Revenue $ is used with Actual Revenue #. (textReplace)
2. Renaming entire subject area from Sample Sales Lite to Sample Sales Lite Version (renameSubjectArea)
3. Rename the files where presentation layer table "Calculated Facts" is used with "Calculated Measures" (renameTable)
4. Rename the files where presentation layer column "Discount Amount" is used with "Discount Amount_1".
Create a new XML file with below syntax. Save it and provide this file as a reference under catalog manager XML Find and Replace utiltiy.
<?xml version="1.0" encoding="utf-8"?>
<actions>
<action command="textReplace" oldValue="Actual Revenue $" newValue="Actual Revenue #" ignoreCase="true"/>
<action command="renameSubjectArea" oldValue="Sample Sales Lite" newValue="Sample Sales Lite Version" ignoreCase="false"/>
<action command="renameTable" subjectArea="Sample Sales Lite" oldValue="Calculated Facts" newValue="Calculated Measures" ignoreCase="true"/>
<action command="renameColumn" oldValue="Discount Amount" newValue="Discount Amount_1" ignoreCase="false"/>
</actions>
We can see the changes after run is completed in the results window.
Now, deploy the changed RPD and restart services. You can see all the changes are reflected in presentation catalog. No impact on the saved reports/analysis.
Similarly, you can use renameFormula option to update specific column formula in the catalog. This may be necessary sometimes as all the calculations may not be directly fetched from repository.
<action command="renameFormula" oldValue=""Sample Sale".Measures."Year Ago Dollars"" newValue=""Sample Sales".Measures."GG YAGODOLLARS"" ignoreCase="false"/>
<action command="renameFormula" subjectArea=""Sample Sales"" oldValue=""Products".Brand" newValue="GGPRODUCTS."GG BRAND"" ignoreCase="false"/>
Remember, dont forget to take backup of originial files.
Cheers...
Hi - I am trying to replace a table.column (Client."Rep First Name"), but I can't seem to get the format correct. The following is not working:
ReplyDeleteDo you know what the correct format should be? Thanks!
the line didnt paste..here it is:
Delete...action command="textReplace" oldValue="Client."Rep First Name" newValue="Rep."Rep First Name" ignoreCase="true"...
And this doesnt seem to work either:
Delete...action command="textReplace" oldValue="Client."Rep First Name" newValue="Rep."Rep First Name" ignoreCase="true"...
Great and I have a super present: Renovation House Company home renovation contractors
ReplyDelete