Variables.

This forum is for all Flare issues not related to any of the other categories.
Post Reply
Kat se gat
Sr. Propeller Head
Posts: 140
Joined: Fri Jan 18, 2013 9:12 am
Location: Crawley, West Sussex, South-East UK

Variables.

Post by Kat se gat »

Let's say I have 1000 words in a project's files containing "insert-something". I can create a variable called InsertWhatever and set its value to say, blah-blah-blah and I can replace them one-by-one.

Is it possible to do a global find-and-replace replace "insert-something" and insert variable InsertWhatever in its place?
Peter

Dad to Rara, Oddzuki, and Ginger Nutkin.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Variables.

Post by NorthEast »

Yep, but first back up your project.

When you use the find and replace, set the Find in source code option.

Find Insert whatever and replace with
<MadCap:variable name="VariableSetName.InsertWhatever" />

Do a Find All first to see the results, then replace one-by-one, or try replace all if you're optimistic.
Kat se gat
Sr. Propeller Head
Posts: 140
Joined: Fri Jan 18, 2013 9:12 am
Location: Crawley, West Sussex, South-East UK

Re: Variables.

Post by Kat se gat »

Thanks Dave. I suspected I might have to give the XML a smack in the face but I hoped there might have been a safer way. Would I be right in assuming that where you write VariableSetName I also replace that with something? I'll dig around and see if anything obvious shouts at me.
Peter

Dad to Rara, Oddzuki, and Ginger Nutkin.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Variables.

Post by NorthEast »

Kat se gat wrote:Would I be right in assuming that where you write VariableSetName I also replace that with something?
The variable set name is the name of the variable file as it appears in Project Organizer; and you can also see it when you hover over a variable.

But just insert the variable you want into a topic, then if you switch to the Text Editor mode, you can see exactly how it looks in the code - then you can just copy/paste that to the replace box.
Kat se gat
Sr. Propeller Head
Posts: 140
Joined: Fri Jan 18, 2013 9:12 am
Location: Crawley, West Sussex, South-East UK

Re: Variables.

Post by Kat se gat »

I got it working as you suggested. I introduced a minor typo in the replace string but once corrected, everything seemed to look okay.
Peter

Dad to Rara, Oddzuki, and Ginger Nutkin.
scooter262
Propeller Head
Posts: 37
Joined: Wed Mar 11, 2009 11:14 am

Re: Variables.

Post by scooter262 »

This is really nothing more than I can do with Notepad++. Madcap should really add a better search-replace option, where you can actually find a text string and replace it with a Variable.
Post Reply