MBee Posted November 25, 2009 Share Posted November 25, 2009 I'm trying to set a default off a yes/no, which when selected would allow all frames on all pages in a document to be changed to selected color. Right now I either get the default overriding all selections or problems between graphic/text resources. Idea is basically: if the "BorderSame" is yes and "BorderColor" is equal to something then all frames in document become selected color (Frame_SwitchRULE) //Switch Rule generated off BorderColor Field else if the "BorderSame" is no then PageOneFrameColor is color selected (PageOneSpecific_SwitchRULE) //Switch Rule generated off PageSpecific Field So to recap: If I use the text rule choice, graphics are not generated If I use the graphic rule with rules in it, it says I can't generate text rule (but it's a graphic switch rule I've been using. Rule below ignores entered colors and generates only default resource. if (Field("BorderSame") == "No, different colors") { if (Field("BorderColors") != "") return Rule("Frame_switchRULE"); else return Resource("Black"); } else { if (Field("BorderColors") == "") return Rule("PageOneFrameColor_switchRULE"); else return Resource("Black"); } Link to comment Share on other sites More sharing options...
LesSjo Posted November 25, 2009 Share Posted November 25, 2009 Looks like your nested if statements are not getting read correctly. Try this. if (Field("BorderSame") == "No, different colors") { if (Field("BorderColors") != ""){ return Rule("Frame_switchRULE"); } else { [color=DarkRed]//assumes Field("BorderColors") == ""[/color] return Resource("Black"); } } else { [color=DarkRed]//assumes Field("BorderSame") != "No, different colors"[/color] if (Field("BorderColors") == "") { return Rule("PageOneFrameColor_switchRULE"); } else { return Resource("Black"); } } return Resource("Black"); [color=DarkRed]//or return NullResource();[/color] Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.