Jump to content

Page supression rule


Recommended Posts

I got the page supression rule to work when I define the xml form to return "yes" or "no" in a drop down. My client doesn't like the yes/no to be stacked, so it would be better to use the yes/no switch in the premade xml form. Only problem is that the rule doesn't work with this. Here is an example of my rule from the on record start.

 

 

if ((Field("myfield 1")) == "yes")

{

FusionPro.Composition.SetBodyPageUsage("Field("myfield 1",true);

}else{

FusionPro.Composition.SetBodyPageUsage("Field("myfield 1",false);

}

if ((Field("Field("myfield 2")) == "yes")

{

FusionPro.Composition.SetBodyPageUsage("Field("myfield 2",true);

}else{

FusionPro.Composition.SetBodyPageUsage("Field("myfield 2",false);

}

 

If I change the "yes" to be one of the literal retuns under the xml form such as "T" or "F", the rule doesn't work. Any Ides what the problem is?

Link to comment
Share on other sites

If I change the "yes" to be one of the literal retuns under the xml form such as "T" or "F", the rule doesn't work. Any Ides what the problem is?

Well, without knowing more about the job, I can only guess. But this code doesn't look right at all:

if ((Field("Field("myfield 2")) == "yes")

You'll definitely get a syntax error with that. Did you quick type that into the form here? Can you copy-and-paste the actual code from the Rule Editor instead? And don't be afraid to click the Go Advanced button, select the code, and then click the # (Wrap CODE tags around selected text) button.

 

I also don't understand this logic. So, if Field1 is "yes", then you turn on the page named "yes"? And if Field2 is "yes", then you also turn on the page named "yes"? That can't be right either.

 

I think that the rule can be as simple as this:

FusionPro.Composition.SetBodyPageUsage("Page1", Field("myfield 1") == "T");
FusionPro.Composition.SetBodyPageUsage("Page2", Field("myfield 2") == "T");

You'll have to change the field and page names as appropriate for your job.

Link to comment
Share on other sites

it works the way I had it, just not with the pre-set yes or no form in the Fusion Pro XML builder. I have to build a picklist for "yes" or "no" to get it to work. My rule is that if filed 1 is yes, the setbody page rule is true, so the page is used, otherwise it is false and the page is suppresd.

 

In your way, what turns the page on or off?

Link to comment
Share on other sites

it works the way I had it, just not with the pre-set yes or no form in the Fusion Pro XML builder.

Again, what you posted is not valid code. Please post the actual code, or the template itself. If you don't do this, then I can't help.

I have to build a picklist for "yes" or "no" to get it to work. My rule is that if filed 1 is yes, the setbody page rule is true, so the page is used, otherwise it is false and the page is suppresd.

Okay, so where does the "T" and "F" come into play in this scenario?

In your way, what turns the page on or off?

You mean this?

FusionPro.Composition.SetBodyPageUsage("Page1", Field("myfield 1") == "T");
FusionPro.Composition.SetBodyPageUsage("Page2", Field("myfield 2") == "T");

Basically, the expression:

Field("myfield 1") == "T"

resolves to a Boolean value of true or false, which then gets passed to the SetBodyPageUsage function and sets the page usage accordingly. But that specific example assumes that the field value we're looking for is "T" and that the pages are named "Page1" and "Page2". I don't know what the page names are in your job; I can't tell from the code you posted, which appears to be passing the field value itself as the name of the page, which is almost certainly wrong.

 

Maybe this would be easier if you posted your template PDF file.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...