PDA

View Full Version : Multiple if statements OnRecordStart


RSloan
July 9th, 2013, 08:00 AM
I am trying to execute 2 independent if statements in the OnRecordStart rule.

One is meant to manage a text box:
if (Field("FieldName") =="")
{
FindTextFrame("MyTextFrame").fillColorName = "white";
FindTextFrame("MyTextFrame").content = "<span color=white>" + FindTextFrame("MyTextFrame").content;
}

The other activates a page in the document:
if (Field("FieldName2") != "")
{
FusionPro.Composition.SetBodyPageUsage("OtherPage",true)
}

Can anyone explain how to keep these two statements independent of each other? I am unable to create 2 different OnRecordStart rules, so I am forced to place them in the same rule. I assume I can insert instructions to treat these statements on their own, but my searches for a solution have been fruitless so far.

Thank you for taking the time to look at this.

Dan Korn
July 9th, 2013, 09:43 AM
You can just put both statements, one after the other, in your OnRecordStart rule. They shouldn't interfere with each other in any way.

Although I'm not sure what you're trying to accomplish by setting a frame's fill to white and setting all the text to white as well. Obviously you're not going to see any text that way. Maybe you just want to suppress the frame instead?

RSloan
July 9th, 2013, 10:01 AM
Thank you very much, Dan.

The code does seem to be executing properly as the statements are currently laid out. I was just worried that they may somehow misfire without some sort of END statement.

As for the text frame rule, I am using it to "white-out" a portion of the background art for certain records. For the other records, this box is transparent allowing the background to show through (along with the black text in the box).

Thanks again for the quick reply!