Jump to content

Suppress multiple frames with one variable?


NoahScheitler

Recommended Posts

Hello,

I have a situation where i have the same 3 text boxes on multiple pages. They are labeled as "Barcode", "Non Barcode", and "Indicia".

I was just wondering if it is possible to write a switch function with a single variable that suppresses multiple same named pages.

For example: if the IMBarcode field is present suppress "Non Barcode". If it is not present suppress "Barcode" and "Indicia"

function handleBarcodeAndIndiciaFrames(imb) {

var Barcode = FindTextFrame("Barcode");

var NoBarcode = FindTextFrame("NoBarcode");

var Indicia = FindTextFrame("Indicia");

try {

var test = imb.toLowerCase();

NoBarcode.suppress = true;

} catch (e) {

Barcode.suppress = true;

Indicia.suppress = true;

}

}

If i have 15 pages with these text boxes is there a way to have 15 "Barcode" frames suppress with that single variable? Or am i forced to name the variables uniquely as in "Barcode1", "Barcode2", etc?

 

Link to comment
Share on other sites

Your question is rather confusing. You ask if there's a way to suppress pages but then everything else seems to be more about suppressing frames.

Either way you can do both in OnRecordStart. Also, just to note, if a Field is empty it will evaluate as false.

So you could do something like this in OnRecordStart:

if (!Field("fieldname"))
{
    FindTextFrame("Barcode1").suppress = false;
    FindTextFrame("Barcode2").suppress = false;
    
    FindTextFrame("Indicia1").suppress = false;
    FindTextFrame("indicia2").suppress = false;
}

or

if (!Field("fieldname"))
{
    for (i = 1; i <= 15; i++)
    {
        FindTextFrame("Barcode" + i).suppress = false;
        FindTextFrame("Indicia" + i).suppress = false;
    }
}

To suppress actual pages it would be:

if (!Field("fieldname"))
{
    FusionPro.Composition.SetBodyPageUsage("page name a", false);
    FusionPro.Composition.SetBodyPageUsage("page name b", false);
    FusionPro.Composition.SetBodyPageUsage("page name c", false);
}

or use a loop if you named them accordingly.

  • Like 1
Link to comment
Share on other sites

Another way to do this, if you are in fact talking about frames and not pages, is to move all the frames into a group using the Document Overview palette. This is a newer feature of FusionPro so you will have to be on one of the more current versions.

If the Document Overview palette is not up, go to menu FusionPro / Palettes / Overview. Then switch to the Groups tab.

There is a New Group icon at the bottom. Once you name the new group, drag the frames you want to group into it.

Then, in OnRecordStart you would use something like this:

if (!Field("fieldname"))
    HideFrameGroup("group name");

Then you don't have to worry about all the frame names or what pages they are on. So long as they are in the group they will suppress.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Thomas's advice is excellent, as usual.

That said, like I mentioned in that other thread, I suspect that there's a way to set up your job so that you don't need 15 different pages in the first place, though I would have to know more about the output you're trying to make.

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...