Skip to main content
Participating Frequently
June 26, 2014
Answered

What is the "scope" of FM Variables?

  • June 26, 2014
  • 3 replies
  • 377 views

Basic question about Variables .... It seems that thwe values of Variables are set per file -- am I wrong?

So, if the footer of every page of every file in the Book has a variable called <MyBookName>, and certain chapters are used in multiple books with different names, and today's variant of the book is called BookA, do I have to import the value of <MyBookName> into every file, or can I just set "BookA" somewhere and press a button to update and print the book? I prefer not  to import "BookA" into every file because ten minutes later, I'm going to generate BookB with a different mix of chapters, and I prefer that the value "BookA" not be inserted into all those chapters. Am I missing something about how Variables are supposed to work?

    This topic has been closed for replies.
    Correct answer Bob_Niland

    Variables are per .fm file.

    We define all the book-specific variables in the first file of the book (cover) and bulk import them into the component files.

    In Book menu, have defining var master file open.

    Select all other component files (which can be open or not).

    You can select the next file then shift_select the last.

    File > Import > Formats

    Import from Document: [ <name of defining file> ]

    [ Deselect All ] (if needed)

  • Variable Definitions

    [ Import ]


    For extra credit, white space permitting, you can display all the key variables on the first page of the defining file, as text hidden for publication by Color Views or Condition Codes. Makes them easier to edit and check for errors.

  • 3 replies

    Legend
    June 27, 2014

    By way of additional info in case you ever need it, here's an example of well-behaved variables: we have a standard "Legal disclaimer" text that I have implemented as a text insert. The source file for the insert uses the variable $product. Referencing the disclaimer in a file where $product is defined as Aardvark pulls Aardvark into the disclaimer; referencing the disclaimer in a file where $product is defined as Zeugma pulls Zeugma into the disclaimer. Very satisfying :-}

    Arnis Gubins
    Inspiring
    June 27, 2014

    Alternatively, you could use Leximation's BookVars plug-in to define a Book level set of variables. See: Leximation: BookVars

    Bob_Niland
    Community Expert
    Bob_NilandCommunity ExpertCorrect answer
    Community Expert
    June 26, 2014

    Variables are per .fm file.

    We define all the book-specific variables in the first file of the book (cover) and bulk import them into the component files.

    In Book menu, have defining var master file open.

    Select all other component files (which can be open or not).

    You can select the next file then shift_select the last.

    File > Import > Formats

    Import from Document: [ <name of defining file> ]

    [ Deselect All ] (if needed)

  • Variable Definitions

    [ Import ]


    For extra credit, white space permitting, you can display all the key variables on the first page of the defining file, as text hidden for publication by Color Views or Condition Codes. Makes them easier to edit and check for errors.

  • Arnis Gubins
    Inspiring
    June 27, 2014

    A word of caution about whole-scale importing of the Variables via FM's import interface. This doesn't differentiate between system and user-defined variables. You may have different definitions for some of the system-level (e.g. Master Page) variables depending upon their location (front matter, body, appendices, etc.) that can get clobbered this way. [Been there, done that, OUCH]

    Rick Quatro has a plug-in called ImportSpecial that allows you to differentiate between these. [Unfortunately, his website is currently being renovated, so contact info is available here: About ] There also is some further info on this topic in this thread: Variable Import Feature