2 Replies Latest reply on Nov 1, 2007 8:25 AM by fanboyfrank

    Converting text to variables in RH7

    fanboyfrank
      I'm upgrading a RH5 project to RH7 and I want to convert all the occurrences of our product name to a variable called ProductName. Do I have to do a find on each one and then convert it? A find-and-replace that allows searching for a text string and replacing with a variable would be sweet, but it doesn't seem to work that way.
      What are my options, other than brute force?
        • 1. Converting text to variables in RH7
          CraigCC Level 2
          Hi Frank,

          First thing, it is not going to be that easy even if you use a powerful replacement tool like BKReplacem. You need to replace 'Product Name' with simlar code to the following .

          <uservariable name=Product_Name x-format=Product_Name x-value='product name' x-showvalue>Product Name</uservariable>

          Secondly, your are also going to have to be a little careful using a search and replace tool as you need to think of all the places where the product name may be used and replacement is not appropriate. Do you use the product name in a filename for example - if so the filename used in any topic hyperlinks may end up braking the link.

          If I were in your boots I'd create an output file of the project and run a search with search highlight on. Track all occurences and yes (not what you wanted to hear sorry) replace each occurence manually.

          Luckily working with variables in RH7 is a lot easier the RH6. You can simply drag and drop the variable from the pod to a topic.

          There is one other trick that I can think of that may help you with this process.

          1. Firstly, when you create you variable, make sure you use exactly the same Variable Value as the text used for the current Product Name throughout your project.

          2. Find and select the product name within the topic.

          3. Right click to display the shortcut menu and then select the Add to - User Defined Variable option.

          If the selected text matches the variable name you set up, it is automatically convereted into a variable.

          Hope that helps
          Craig
          • 2. Re: Converting text to variables in RH7
            fanboyfrank Level 1
            Hi Craig -

            Thanks for the quick response.

            I've always been very leery of using RH's find-and-replace - too easy to miss occurrences due to line breaks and too easy to mistakenly replace strings in hyperlinks or other places that should be left alone.

            I think for my own peace of mind, I'll stick with your second suggestion.

            - Frank -