Update Variable across the Book

Contributor ,
Mar 10, 2017

Copy link to clipboard

Copied

Hi All,

If I have a Book with 10 Chapters; in each chapter, I have a Variable called "Manual Name".

Is there a way to change a variable value, so it can be updated in entire book at once?

If it involves more scripting, how difficult would that be?

Any insight would be greatly appreciated.

Thanks.

TOPICS
Formatting and numbering

Views

2.6K

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Most Valuable Participant , Mar 10, 2017
Arnis_Gubins Most Valuable Participant , Mar 10, 2017
Expanding on what Matt said about creating a MIF file, it's just a simple text file called a MIF snippet that looks like this:<MIFFile 14.00><VariableFormats<VariableFormat   <VariableName `MyBookName'>   <VariableDef `The title of this book'>  > # end of VariableFormat> # end of VariableFormatsAlso have a look at this thread, which covers the same topic: Variable to Pull Book Name?Finally, you could also try Leximation's BookVars. See: http://leximation.com/tools/info/bookvars.php

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Mar 10, 2017

Copy link to clipboard

Copied

If only the Variable Definition needs to be changed,

and if no Variables deliberately have different defs in any book files,

then just change it in one book file, and
do an Import > Formats
De-select All

Select Variables

from the defining file.

And yes, this suggests that it's useful to have a consistent policy of making one book file the defining instance of as much stuff as possible.

If, on the other hand, you need to change the Variable name - different problem.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Mar 10, 2017

Copy link to clipboard

Copied

You can do this (at least) two ways:

  1. Import variables  by using the File>Import>Formats command across all files of the book.
    1. advantage: easy, quick
    2. disadvantage: all variables are updated, and you may/may not want this
  2. Create a MIF file of the variable and import only that variable across the book.

Sign up for my (free) Tech Comm Tools community, and I'll send you the relevant MIF section of FrameMaker - Creating and Publishing Content.

-Matt

techcommtools.com

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Mar 10, 2017

Copy link to clipboard

Copied

Expanding on what Matt said about creating a MIF file, it's just a simple text file called a MIF snippet that looks like this:

<MIFFile 14.00>

<VariableFormats

<VariableFormat

   <VariableName `MyBookName'>

   <VariableDef `The title of this book'>

  > # end of VariableFormat

> # end of VariableFormats

Also have a look at this thread, which covers the same topic: Variable to Pull Book Name?

Finally, you could also try Leximation's BookVars. See: http://leximation.com/tools/info/bookvars.php

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aixtron AUTHOR
Contributor ,
Mar 10, 2017

Copy link to clipboard

Copied

Thank you all,

Everyone has same response at least in the importing part. Appreciate it very much.

After thought, in my case Import will not work because I have other variables such as Chapter Name, where name is changing for every chapter.

I believe, I will have to go MIF route, the way Arnis has described it.

This will be a good short first try for me.

Once again everyone, appreciate your help.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Mar 10, 2017

Copy link to clipboard

Copied

re: After thought, in my case Import will not work because I have other variables such as Chapter Name, where name is changing for every chapter.

Why are you doing that?

It usually enables cleaner stewardship to do that as an Xref to some Heading, or via RHF Marker, or even some metatext.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Mar 10, 2017

Copy link to clipboard

Copied

Bob,

   You can create a new document in which the only user variables are those that you want to import into all documents in the book. The only problem you may run into is if your system variables are different in different files.

   --Lynne

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Mar 10, 2017

Copy link to clipboard

Copied

re: You can create a new document in which the only user variables are those that you want to import into all documents in the book.

Not ever having used it, it rather appears that the MIF snippet trick above would allow update of a single Variable.

re: The only problem you may run into is if your system variables are different in different files.

I've always made it an objective to keep user and non-default system variables identical across files in a book, typically using the first file in the book as the repository. For a current project, it's actually a separate template.fm file in the book dir.

For that project, I need the header to show a short version of the current Heading1. <$Marker1> works perfectly, almost like that's what it was designed for .

If that weren't available, I'd attach a run-in or margin Anchored Frame to each H1, with a text frame in it, containing that same shortened heading in a unique ¶format, say, Heading1.Short in a color set to invisible in Color Views for rendering, then have the RH/F pick that up. This also allows Xrefs to that short H1 from anywhere in the book (a Spot Xref hack).

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Mar 13, 2017

Copy link to clipboard

Copied

Unfortunately this does not work!

You can import a MIF snippet only into a file (via Import | File) and not into a book.

You cannot import a file into a book.

Of course you can import a MIF snippet into a single file and then import all variables of this file into the other files of a book.

Therefore I can only support what the others had said: Do not use different variable values in the files of your book.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Mar 13, 2017

Copy link to clipboard

Copied

Hi Winfried,

If the MIF file is opened into FrameMaker, then you can import across the book.

Be careful not to save the opened MIF file, however, as I recall that saving introduces all of the system variables with default values.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Mar 13, 2017

Copy link to clipboard

Copied

Matt,

If you open a MIF snippet, then it becomes a full FM file with system variables. If you then import the variables from this MIF across all files in the book, you will clobber those system variables with FM's defaults automatically generated when the MIF snippet is opened. This can be a real PITA to undo.

Unfortunately a MIF snippet has to be imported by copy into each file for this to work properly.

The alternative is to use Scott's BookVars plug-in.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Mar 14, 2017

Copy link to clipboard

Copied

Arnis, can you please recheck that behavior? In my experience I've successfully used MIF as described. As long as the opened MIF is not saved after opening, it works for me.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Mar 14, 2017

Copy link to clipboard

Copied

Matt,

Test it for yourself, if you don't follow the rational

Open a MIF snippet and you will find that FM has created/added all of the default system variables [simply check the variables pod to see what's there] along with Master and Reference pages. If you now import the variable formats from the opened MIF snippet into other files in a book, the existing system variables in the book files will get over-written by the FM defaults created for the opened MIF snippet. IF one has never changed the default system variables, then this is acceptable. However, if one has modified or used some of them (e.g. the additional running h/f variables), then these get clobbered.

Import a MIF snippet by copy and only the variable definition(s) in the snippet are added/updated. Unfortunately, import by copy is one file at a time and can't be done en mass for a book without some form of scripting.

This would all be so much simpler and easier if the Import Formats option differentiated between user-defined and system variables, like Rick Quatro's ImportFormatsSpecial utility does.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more