Jump to content

Show/Hide FP Text Frames?


Recommended Posts

Hi everyone,

I have a letter that is 4 versions. The base art is the same across all 4 versions, it's just the letter that is variable (and each letter has variables within the paragraphs of text). Normally, I would just process this as 4 versions but because this will mail, the associated mailing lists have been combined into one list. In looking at the documentation for FP, it looks like maybe objects can be hidden/shown with a JavaScript rule but I am not able to make sense of it. As I have no experience with JavaScript, could someone please provide the code to achieve this?

Thank you so much,
jm

Link to comment
Share on other sites

One way to do this is stack all the text frames on top of each other and turn them all off via script. Then turn on the one that's needed.

Make a new Event rule for OnRecordStart and add this:

FindTextFrame("Name1").suppress = true;
FindTextFrame("Name2").suppress = true;
FindTextFrame("Name3").suppress = true;
FindTextFrame("Name4").suppress = true;

if (Field("Version") == "Ver1")
    FindTextFrame("Name1").suppress = false;
else if (Field("Version") == "Ver2")
    FindTextFrame("Name2").suppress = false;
else if (Field("Version") == "Ver3")
    FindTextFrame("Name3").suppress = false;
else if (Field("Version") == "Ver4")
    FindTextFrame("Name4").suppress = false;

You need to name your text frames appropriately and swap out the names in the script with whatever is in your document.

The "Ver1", "Ver2", etc values should be whatever value would be in your Version field to determine which frame gets turned on.

If this doesn't work out for you, I would suggest posting your template and sending a sample data file that doesn't contain anything personal in it.

Link to comment
Share on other sites

On 11/16/2023 at 4:22 PM, ThomasLewis said:

One way to do this is stack all the text frames on top of each other and turn them all off via script. Then turn on the one that's needed.

Make a new Event rule for OnRecordStart and add this:

FindTextFrame("Name1").suppress = true;
FindTextFrame("Name2").suppress = true;
FindTextFrame("Name3").suppress = true;
FindTextFrame("Name4").suppress = true;

if (Field("Version") == "Ver1")
    FindTextFrame("Name1").suppress = false;
else if (Field("Version") == "Ver2")
    FindTextFrame("Name2").suppress = false;
else if (Field("Version") == "Ver3")
    FindTextFrame("Name3").suppress = false;
else if (Field("Version") == "Ver4")
    FindTextFrame("Name4").suppress = false;

You need to name your text frames appropriately and swap out the names in the script with whatever is in your document.

The "Ver1", "Ver2", etc values should be whatever value would be in your Version field to determine which frame gets turned on.

If this doesn't work out for you, I would suggest posting your template and sending a sample data file that doesn't contain anything personal in it.

This is equivalent to:

for (var i = 1; i <= 4; i++)
  	FindTextFrame("Name" + i).suppress = (Field("Version") != "Ver" + i);

If you have groups of frames that you want to show and hide, you can set up named frame groups in the Document Overview palette and call HideFrameGroup or ShowFrameGroup.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...