Jump to content

Need to place an alert message in Compostion window


rgreenidge

Recommended Posts

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

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

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

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

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

Archived

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

×
×
  • Create New...