Showing posts with label Presentation Layer. Show all posts
Showing posts with label Presentation Layer. Show all posts

Monday, April 2, 2012

Globally change RPD changes to catalog file - II

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.

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="&quot;Paint Exec&quot;.Measures.&quot;Year Ago Dollars&quot;" newValue="&quot;Paint Exec&quot;.Measures.&quot;GG YAGODOLLARS&quot;" ignoreCase="false"/>
<action command="renameFormula" subjectArea="&quot;Paint Exec&quot;" oldValue="&quot;Products&quot;.Brand" newValue="GGPRODUCTS.&quot;GG BRAND&quot;" ignoreCase="false"/>
</actions>

  1. 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.
  2. renameSubjectArea :- This will change only the subject area name from the catalog XMLs.
  3. renameTable :- This will change the Table name of the presentation layer (folder).
  4. renameColumn :- This will update presentation column name of the folder.
  5. renameFormula :- This option will update formulas applied in the criteria.
Once all changes are specified in xml file, save file in .XML format and import the file in the Import option from the XML Search/Replace window.

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="&quot;Sample Sale&quot;.Measures.&quot;Year Ago Dollars&quot;" newValue="&quot;Sample Sales&quot;.Measures.&quot;GG YAGODOLLARS&quot;" ignoreCase="false"/>
<action command="renameFormula" subjectArea="&quot;Sample Sales&quot;" oldValue="&quot;Products&quot;.Brand" newValue="GGPRODUCTS.&quot;GG BRAND&quot;" ignoreCase="false"/>


Remember, dont forget to take backup of originial files. 

Cheers...



























































Saturday, March 31, 2012

Globally change RPD changes to catalog file - I



Many a times we face the situation where any changes on RPD presentation layer, causing lots of rework on web catalog side by manaully changing references of the column/table/subject area.

Instead of maunally changing the references in all the reports, we can use Catalog manager's option of XML Search and Replace for small changes. If there are significant changes, we can explore XML file option to write all the changes in one file and make changes in ONE Go.

Option 1 :- XML Search and Replace

This option is straight forward and easy to use. You should know what is the change required in catalog files. To give you an example, I have changed subject area folder column from Revenue to Actual Revenue.  Shown the change below.

Now I need to change all the references in the catalog files to replicate this change. (I know keeping Alias on the Presentation later will also work, but dont want to keep aliases in my first build).

  • Open Catalog Manager. Open catalog file in offline mode (preferred).
  • Make sure you have already taken a backup of the code.
  • Select the Folder from the catalog tree. (My case, I wanted to change it globally, so selected "Shared"
  • Now Navigate to Tools -> XML Search/Replace Option (Ctrl +H)
  • New window opens up with options like Old Text/New Text.
  • Provide the change as needed. I have changed from "Revenue" to "Actual Revenue"
  • ( Import File Option will be covered in next blog.




















 
  •  Click OK to start search/Replace operation.
  • Once completed, results will be shown with the changed on the reports/analysis in catalog.






















Once these changes are completed, deploy the new files and start the services. If this is done online, server restart is not required.

Assuming, server is restarted, I will now login to portal to do sanity check on the changed dashboards.
Here you go. I can see the changes reflected in catalog files and existing dashboards remain intact. :-)

Please note that, this option is not receommended as it might change other part of the code if same name is used for report name, subject area, conditions,etc. Always prefer to go by "Import From File" option.


Now, I will explain how to use "Import from File" in next blog.

Cheers...