ericg Posted March 18, 2009 Share Posted March 18, 2009 Hello, I have a postcard document that i use for two different purposes (reminders & confirmations). Based on whether the input file starts with a certain word (ie "remind" or "confirm") i have some logic puts certain paragraphs in and takes certain ones out. This all works fine when i compose it, but i'd like to be able to preview it first sometimes. Does anyone know how i can do this? Currently I'm going in to the onjobstart rule every time and changing a variable name in an if statement that checks to see if its in preview mode or not in order to preview the correct postcard type. something like: var inputFilename ; if (FusionPro.Composition.IsPreview) { inputFilename = "Remind"; //inputFilename = "Confirm"; } can anyone tell me if there is another way to make the preview work? Thanks, Eric Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 18, 2009 Share Posted March 18, 2009 Hello, I have a postcard document that i use for two different purposes (reminders & confirmations). Based on whether the input file starts with a certain word (ie "remind" or "confirm") i have some logic puts certain paragraphs in and takes certain ones out. This all works fine when i compose it, but i'd like to be able to preview it first sometimes. Does anyone know how i can do this? I don't understand. What exactly doesn't work in Preview that works otherwise? can anyone tell me if there is another way to make the preview work? Precisely what are you trying to make "work"? Quote Link to comment Share on other sites More sharing options...
ericg Posted March 18, 2009 Author Share Posted March 18, 2009 Ok, below is an example of a rule i have: if (FusionPro.inValidation) Rule("OnJobStart"); if (Left(inputfile, 3) == "REM") { return "To confirm your reservation, get driving directions, or if you are unable to attend but would like more information, please call"; } else if (Left(inputfile, 3) == "CON") return "If you have questions or need driving directions, please call"; else return ""; here is an example of my OnJobStart rule: inputfile = FusionPro.Composition.inputFileName; inputfile = ReplaceSubstring(inputfile, "/Users/VariableG5Pro/Desktop/Work Folder/", ""); if (FusionPro.Composition.isPreview) { //inputfile = "REM"; inputfile = "CON"; } when i take out the IF statement in the OnJobStart rule and then preview the document, the paragraph isn't shown. But if i just compose the job the text is there. I would just like to know if there is a way to preview the document without having to go into the rule every time and Commenting/Uncommenting the lines in the IF statement? Thanks, Eric Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 18, 2009 Share Posted March 18, 2009 when i take out the IF statement in the OnJobStart rule and then preview the document, the paragraph isn't shown. But if i just compose the job the text is there. I would just like to know if there is a way to preview the document without having to go into the rule every time and Commenting/Uncommenting the lines in the IF statement? Ah, I see what you're trying to do now. The problem you're running into is that Preview is a special case, where things aren't set up quite the same way as for a "regular" composition. Specifically, for Preview, the input file is not actually the file you've specified in the Data Source Wizard; instead, it's a single-record file in your temp folder, whose name is something like "124371912_IN.txt". (Preview would take a long time if it had to read in the entire input file to find just the record you're trying to see, so we auto-generate a little file with just the data for that record, which is much easier for the Preview composition to digest.) So, no, you can't really switch off of the name of that auto-generated Preview input file. I can think of a couple of alternatives. You could add a field to the input file which specifies its "purpose" (reminders vs. confirmations) and switch off of that. Or you could use a simple ExternalDataFileEx that you read in only for Preview compositions where you specify either "remind" or "confirm", and then you could modify that in an external text editing application and click Refresh on the Preview Record Selector. Quote Link to comment Share on other sites More sharing options...
ericg Posted March 18, 2009 Author Share Posted March 18, 2009 Thank you that worked very well. I added the field to my input file and adjusted my rules accordingly. Now it previews correctly with the exception of the Postal Indicia since its based on the number of records in the FusionPro.Composition.InputfileName. But i can live with that, unless you know of a way short of putting the recordcount in a field of my inputfile. Or some function i have not found in FusionPro yet that will do that for me during preview. Thanks, Eric Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 18, 2009 Share Posted March 18, 2009 Thank you that worked very well. I added the field to my input file and adjusted my rules accordingly. Now it previews correctly with the exception of the Postal Indicia since its based on the number of records in the FusionPro.Composition.InputfileName. But i can live with that, unless you know of a way short of putting the recordcount in a field of my inputfile. Or some function i have not found in FusionPro yet that will do that for me during preview. Keep in mind that Preview is just a tool to help you in the development of your template, to facilitate things like seeing what happens when you change something small in your job. It's no substitute for the output of a full-blown composition (and ultimately, sending the output to a printer or RIP). Anything that relies upon the aggregation of, or dependencies between, multiple records simply is not applicable to Preview. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 27, 2013 Share Posted June 27, 2013 But i can live with that, unless you know of a way short of putting the recordcount in a field of my inputfile. Or some function i have not found in FusionPro yet that will do that for me during preview. In FusionPro 8.2 and later, you can access the FusionPro.Composition.totalRecordCount property, if you have turned on preprocessing in OnJobStart by setting FusionPro.Composition.forcePreprocessing = true. The more general issue of not being able to access the original input data file in Preview or rule validation will be addressed in the upcoming FusionPro 9.2 release, with a new function PrimaryInputFile(). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.