Jump to content

Can a rule be written for this?


jrich

Recommended Posts

We have a multiple documents that correspond with the data file. We have a file graphic (really a page) called earthquake.tif. In the data file there is a column for earthquake. We want to print out a quantity of earthquake.tif depending on the number in the earthquake column in the data file. Then we want to print a slip sheet and then we want to move onto the next file based on the records in the data file. We also have personal information that will print on each page.

 

The other thing we need is to not print any pages or an blank pages if the number in the data file is 0.

 

We have tried many different rules, but are new to JavaScript and are not sure how to get this to behave properly.

Link to comment
Share on other sites

Thank you for the help. I was just wondering what you mean by "in OnRecordStart" like I said we are new to the program and to JavaScript.

From the menu in Acrobat, select "FusionPro -> Edit Rules." Click "New." Click the "Callback" radio button, select the OnRecordStart rule, and click "Next." Paste the rule logic from my previous post into the main Expressions area of the Rule Editor dialog, and click "OK."

Link to comment
Share on other sites

Here is another twist...The column names in the spreadsheet are actually the names of the "documents" we want to print and then the quantity is listed below each of the column headers. We still need the slipsheet between each column header change.
Link to comment
Share on other sites

I have uploaded a sample file to explain what I am trying to do. I have two people listed. I want to print three copies of "file1" for the first person on the list. Then I want a slipsheet to print. Then I want 5 copies of "file2", a slipsheet, 8 copies of "file3", and then a different color slipsheet. Then I want to print out 1 copy of "file1, a slipsheet, 9 copies of file2, and a second colored slipsheet. I would get no copies of file 3 because that is a zero.

 

I have each file name setup as a body page and the two slipsheets setup as unused body pages.

 

I am able to get the right number of copies for everyone, for one file, with a slipsheet between each person. However, I am unable to get this to work the way I want.

Example.txt

Link to comment
Share on other sites

I am also including what I have so far for a rule here with the comments in it. Please advise if you have an idea on how to make this work.

 

//This part of the rule is to get a slipsheet to print between each name.

var CurrentSalesRep = Field("NAME");

if((FusionPro.Composition.processedRecordNumber != 1) && (LastSalesRep != CurrentSalesRep))

{

FusionPro.Composition.SetBodyPageUsage ("Rep", true);

}

//This part of the rule is to set the "Earthquake" body page to print if the field in

//data file is something greater than 0. It will also print the number of pages based

//number in the data file.

if (Field("Earthquake 40-5126H") > StringToNumber ("0"))

{

FusionPro.Composition.SetBodyPageUsage ("Earthquake", true);

FusionPro.Composition.repeatRecordCount = Field("Earthquake 40-5126H");

FusionPro.Composition.SetBodyPageUsage ("Fire", false);

FusionPro.Composition.SetBodyPageUsage ("Flood", false);

FusionPro.Composition.SetBodyPageUsage ("Hurricane", false);

FusionPro.Composition.SetBodyPageUsage ("Tornado", false);

FusionPro.Composition.SetBodyPageUsage ("VolcanicAsh", false);

FusionPro.Composition.SetBodyPageUsage ("Wildfire", false);

FusionPro.Composition.SetBodyPageUsage ("Winter", false);

FusionPro.Composition.SetBodyPageUsage ("Prepared", false);

FusionPro.Composition.SetBodyPageUsage ("Thunderstorm", false);

}

//This part tells it not to print anything, including the slipsheet, if the number

//in the data file is zero.

else

{

if (Field("Earthquake 40-5126H") == StringToNumber ("0"))

{

FusionPro.Composition.SetBodyPageUsage ("Earthquake", false);

FusionPro.Composition.SetBodyPageUsage ("Fire", false);

FusionPro.Composition.SetBodyPageUsage ("Flood", false);

FusionPro.Composition.SetBodyPageUsage ("Hurricane", false);

FusionPro.Composition.SetBodyPageUsage ("Tornado", false);

FusionPro.Composition.SetBodyPageUsage ("VolcanicAsh", false);

FusionPro.Composition.SetBodyPageUsage ("Wildfire", false);

FusionPro.Composition.SetBodyPageUsage ("Winter", false);

FusionPro.Composition.SetBodyPageUsage ("Prepared", false);

FusionPro.Composition.SetBodyPageUsage ("Thunderstorm", false);

FusionPro.Composition.SetBodyPageUsage ("Rep", false);

}

}

//Need to output here or need a different variable for the repeat record count, but

//can't do it. Need to do this for each one.

if (Field("Fire Prevention 40-5016C") > StringToNumber ("0"))

{

FusionPro.Composition.SetBodyPageUsage ("Fire", true);

FusionPro.Composition.repeatRecordCount = Field("Fire Prevention 40-5016C");

FusionPro.Composition.SetBodyPageUsage ("Earthquake", false);

FusionPro.Composition.SetBodyPageUsage ("Flood", false);

FusionPro.Composition.SetBodyPageUsage ("Hurricane", false);

FusionPro.Composition.SetBodyPageUsage ("Tornado", false);

FusionPro.Composition.SetBodyPageUsage ("VolcanicAsh", false);

FusionPro.Composition.SetBodyPageUsage ("Wildfire", false);

FusionPro.Composition.SetBodyPageUsage ("Winter", false);

FusionPro.Composition.SetBodyPageUsage ("Prepared", false);

FusionPro.Composition.SetBodyPageUsage ("Thunderstorm", false);

}

else

{

if (Field("Fire Prevention 40-5016C") == StringToNumber ("0"))

{

FusionPro.Composition.SetBodyPageUsage ("Fire", false);

FusionPro.Composition.SetBodyPageUsage ("Rep", false);

FusionPro.Composition.SetBodyPageUsage ("Earthquake", false);

FusionPro.Composition.SetBodyPageUsage ("Flood", false);

FusionPro.Composition.SetBodyPageUsage ("Hurricane", false);

FusionPro.Composition.SetBodyPageUsage ("Tornado", false);

FusionPro.Composition.SetBodyPageUsage ("VolcanicAsh", false);

FusionPro.Composition.SetBodyPageUsage ("Wildfire", false);

FusionPro.Composition.SetBodyPageUsage ("Winter", false);

FusionPro.Composition.SetBodyPageUsage ("Prepared", false);

FusionPro.Composition.SetBodyPageUsage ("Thunderstorm", false);

}

}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...