Gerard Posted February 7, 2013 Share Posted February 7, 2013 Hi, I try to write a rule but nothing seems to work properly… In a 8 pages document, we use 2 choices successively ("in cascade") that validate the creation of a 2 or a 3 pages final downloadable document. first choice : Option 1 eliminate pages 1 / 2 / 3 / 4 (pages 5 / 6 / 7 / 8 are used) Option 2 eliminate pages 5 / 6 (pages 1 / 2 / 3 / 4 / 7 / 8 are used) Then choice 2 comes to eliminate half of the resulting pages : First case : page 5 / 7 (pages 8 / 6 are used) or 6 / 8 (pages 1 / 3 are used) then we have our 2 pages final document. Second case : 1 / 3 / 7 (pages 2 / 4 / 8 are used) or 2 / 4 / 8 (pages 1 / 3 / 7 are used) then we have our 3 pages final document. I tried this : ---------------------------------------------------------------------------------------- if (Field("flux")=="Bi flux") { FusionPro.Composition.SetBodyPageUsage("Corps 1", false); } { FusionPro.Composition.SetBodyPageUsage("Corps 2", false); } { FusionPro.Composition.SetBodyPageUsage("Corps 3", false); } { FusionPro.Composition.SetBodyPageUsage("Corps 4", false); } if (Field("flux")=="Tri flux") { FusionPro.Composition.SetBodyPageUsage("Corps 5", false); } { FusionPro.Composition.SetBodyPageUsage("Corps 6", false); } if (Field("logo-2")=="") { FusionPro.Composition.SetBodyPageUsage("Corps 2", false); } { FusionPro.Composition.SetBodyPageUsage("Corps 4", false); } { FusionPro.Composition.SetBodyPageUsage("Corps 6", false); } { FusionPro.Composition.SetBodyPageUsage("Corps 8", false); } ----------------------------------------------------------------------------- But when trying to validate the rule, I have the error message "Function returns no value" or "No value returned" (I use a french version of FusionPro…) If someone could tell where I am wrong (or so stupid !), I would be grateful. Gerard. Quote Link to comment Share on other sites More sharing options...
johnw Posted February 7, 2013 Share Posted February 7, 2013 Hi Gerard, I always have to write a conditional statement for each combination of values in order to make something like this work. I also have to turn on(true) and off(false) the necessary pages for each condition. Like this: if (Field("Flux")=="bi-flux" && (Field("Logo")=="a")) { FusionPro.Composition.SetBodyPageUsage("Corps 1", false); FusionPro.Composition.SetBodyPageUsage("Corps 2", false); FusionPro.Composition.SetBodyPageUsage("Corps 3", false); FusionPro.Composition.SetBodyPageUsage("Corps 4", false); FusionPro.Composition.SetBodyPageUsage("Corps 5", true); FusionPro.Composition.SetBodyPageUsage("Corps 6", false); FusionPro.Composition.SetBodyPageUsage("Corps 7", true); FusionPro.Composition.SetBodyPageUsage("Corps 8", false); } For each additional condition, use "else if". The problem with this is that the rule gets really long if you have a lot of conditions. I'm sure there's a simpler way to do this but I haven't figured it out yet. Good Luck! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted February 7, 2013 Share Posted February 7, 2013 But when trying to validate the rule, I have the error message "Function returns no value" or "No value returned" (I use a french version of FusionPro…) If someone could tell where I am wrong (or so stupid !), I would be grateful. The FusionPro.Composition.SetBodyPageUsage function can be called only from the OnRecordStart callback rule. Quote Link to comment Share on other sites More sharing options...
Gerard Posted February 8, 2013 Author Share Posted February 8, 2013 Thank you Johnw ! I will try your formulation ! Dan, I re entered my rule in an "On record start" and I have no more error message. Thank you all ! Quote Link to comment Share on other sites More sharing options...
Gerard Posted February 8, 2013 Author Share Posted February 8, 2013 I have another (little) question. In my example, one case is if a field remains empty (typed ""). Is there a way to type "if the field is NOT empty ? I'm searching but I feel I'm the only one concerned by a non empty field… Gerard. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted February 8, 2013 Share Posted February 8, 2013 I have another (little) question. In my example, one case is if a field remains empty (typed ""). Is there a way to type "if the field is NOT empty ? I'm searching but I feel I'm the only one concerned by a non empty field… Gerard. if (Field("YourFieldName") != "") { // do something if the field is non-empty } Or, equivalently: if (Field("YourFieldName")) { // do something if the field is non-empty } Quote Link to comment Share on other sites More sharing options...
Gerard Posted February 8, 2013 Author Share Posted February 8, 2013 Thank you Dan, I think it will be really helpful ! G. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.