rgreenidge Posted December 16, 2008 Share Posted December 16, 2008 I am currently working on job where I am using the OnRecord Start Rule. The problem I am having is that, if the value in my data does not match the "case" part of my rule it naturally does not compose a page. It also however does not give me an error in the message log. The only way we know there is a problem is when we go to preview the job on our NexPress, the number of records does not match what is composed. So if it is possible we would like to have a error message appear in the log when the "case" does not match the data being called, so that we can pinpoint the record for correction. Thanks, Richard. Link to comment Share on other sites More sharing options...
mhilger Posted December 16, 2008 Share Posted December 16, 2008 Richard, You can put custom messages in the composition message log by using the Print() function in your JavaScript rules. The message can be completely customized and works in text/graphic rules as well as the Callback rules. Try this: Print('There was an error with record ' + CurrentRecordNumber()); Link to comment Share on other sites More sharing options...
rgreenidge Posted December 16, 2008 Author Share Posted December 16, 2008 Hi Mark, thanks for the quick reply, where in my would I place the print function? I have pasted my current rule below. if (Field("PR_FLAG") == "4055UR1") { FusionPro.Composition.SetBodyPageUsage("PH1 P1", true); FusionPro.Composition.SetBodyPageUsage("PH1 P2", true); } else if (Field("PR_FLAG") == "4055R1F") { FusionPro.Composition.SetBodyPageUsage("PH1 P1", true); FusionPro.Composition.SetBodyPageUsage("PH1 P2", true); } return "" Link to comment Share on other sites More sharing options...
a-c Posted December 16, 2008 Share Posted December 16, 2008 You could use a variable as an error flag. PR_FLAG_ERROR = 1; if (Field("PR_FLAG") == "4055UR1") { PR_FLAG_ERROR = 0; FusionPro.Composition.SetBodyPageUsage("PH1 P1", true); FusionPro.Composition.SetBodyPageUsage("PH1 P2", true); } else if (Field("PR_FLAG") == "4055R1F") { PR_FLAG_ERROR = 0; FusionPro.Composition.SetBodyPageUsage("PH1 P1", true); FusionPro.Composition.SetBodyPageUsage("PH1 P2", true); } if (PR_FLAG_ERROR == 1) { Print('There was an error with record ' + CurrentRecordNumber()); } return "" My syntax may be off. But something like this would work. Link to comment Share on other sites More sharing options...
pklingler Posted December 16, 2008 Share Posted December 16, 2008 Always end an if rule with an else statement, to catch the cases where something doesn't match your conditions. You could put the print function as the else. Is your rule supposed to activate the same pages for both conditions, or is that a typo? Something like this should work. if (Field("PR_FLAG") == "4055UR1") { FusionPro.Composition.SetBodyPageUsage("PH1 P1", true); } else if (Field("PR_FLAG") == "4055R1F") { FusionPro.Composition.SetBodyPageUsage("PH1 P2", true); } else { Print(Field("PR_FLAG") + 'did not match on record # ' + CurrentRecordNumber()); } You might want to put a specific field in the error message (like a record ID from the database), instead of CurrentRecordNumber, which is subject to change with stacking impositions. Link to comment Share on other sites More sharing options...
rgreenidge Posted December 16, 2008 Author Share Posted December 16, 2008 That worked perfectly. Thanks for your help. Richard. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.