|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello All,
I've successfully placed a set of 6 conditions as an if/else statement within an On Record Start rule, which returns one of 6 different body pages based on pricing variable entries. I'm calling that a "set" of conditions. I now need to add 2 additional layouts options [Unit of Sale] (which will contain 6 pages each, that change with the pricing entries); and, a pull down menu (i.e. 1 For, 2 For, 3 For) with three choices that will call the appropriate set of (6) conditions. I've attempted to add the "Unit of Sale" conditions within all my statements with "Logical Ands", duplicate the set of 6 for the other 2 layouts, and edit the body pages that are being called. Can anyone offer any help with this attempt or direction? Thanks. :-) Here's my stab at containing this in one On Record Start Rule (it validates but doesn't return any preview so far) : if (Field("UnitOfSale") == "1 For" && Field("DollarAmount") >= 20) { FusionPro.Composition.SetBodyPageUsage("TwentyPlus PricingLayout", true); } else if (Field("UnitOfSale") == "1 For" && Field("DollarAmount") == 11) { FusionPro.Composition.SetBodyPageUsage("DollarAmou ntEleven", true); } else if (Field("UnitOfSale") == "1 For" && Field("DollarAmount") >= 10) { FusionPro.Composition.SetBodyPageUsage("DoubleDigi tPricingLayout", true); } else if (Field("UnitOfSale") == "1 For" && Field("DollarAmount") == 1) { FusionPro.Composition.SetBodyPageUsage("DollarAmou ntOne", true); } else if (Field("UnitOfSale") == "1 For" && Field("DollarAmount") == "") { FusionPro.Composition.SetBodyPageUsage("LessThanOn eDollar", true); } else (Field("UnitOfSale") == "1 For") { FusionPro.Composition.SetBodyPageUsage("SingleDigi tPricingLayout", true); } if (Field("UnitOfSale") == "2 For" && Field("DollarAmount") >= 20) { FusionPro.Composition.SetBodyPageUsage("2ForTwenty PlusPricing", true); } else if (Field("UnitOfSale") == "2 For" && Field("DollarAmount") == 11) { FusionPro.Composition.SetBodyPageUsage("2ForDollar AmountEleven", true); } else if (Field("UnitOfSale") == "2 For" && Field("DollarAmount") >= 10) { FusionPro.Composition.SetBodyPageUsage("2ForDouble DigitPricing", true); } else if (Field("UnitOfSale") == "2 For" && Field("DollarAmount") == 1) { FusionPro.Composition.SetBodyPageUsage("2ForDollar AmountOne", true); } else if (Field("UnitOfSale") == "2 For" && Field("DollarAmount") == "") { FusionPro.Composition.SetBodyPageUsage("2ForLessTh anOneDollar", true); } else (Field("UnitOfSale") == "2 For") { FusionPro.Composition.SetBodyPageUsage("2ForSingle DigitPricing", true); } if (Field("UnitOfSale") == "3 For" && Field("DollarAmount") >= 20) { FusionPro.Composition.SetBodyPageUsage("3ForTwenty PlusPricing", true); } else if (Field("UnitOfSale") == "3 For" && Field("DollarAmount") == 11) { FusionPro.Composition.SetBodyPageUsage("3ForDollar AmountEleven", true); } else if (Field("UnitOfSale") == "3 For" && Field("DollarAmount") >= 10) { FusionPro.Composition.SetBodyPageUsage("3ForDouble DigitPricing", true); } else if (Field("UnitOfSale") == "3 For" && Field("DollarAmount") == 1) { FusionPro.Composition.SetBodyPageUsage("3ForDollar AmountOne", true); } else if (Field("UnitOfSale") == "3 For" && Field("DollarAmount") == "") { FusionPro.Composition.SetBodyPageUsage("3ForLessTh anOneDollar", true); } else (Field("UnitOfSale") == "3 For") { FusionPro.Composition.SetBodyPageUsage("3ForSingle DigitPricing", true); }
__________________
Anthony Bice Pointsmith LLC - Houston, TX FP 6.2P1a, MAC OSX 10.5.8, Acrobat 9.3.2 |
|
#2
|
||||
|
||||
|
Quote:
Quote:
I think in this situation it would be better to use nested IFs like this: Code:
if (Field("UnitOfSale") == "1 For") {
if (Field("DollarAmount") >= 20) {
FusionPro.Composition.SetBodyPageUsage("TwentyPlusPricingLayout", true);
}
else if (Field("DollarAmount") == 11) {
FusionPro.Composition.SetBodyPageUsage("DollarAmountEleven", true);
}
else if (Field("DollarAmount") >= 10) {
FusionPro.Composition.SetBodyPageUsage("DoubleDigitPricingLayout", true);
}
else if (Field("DollarAmount") == 1) {
FusionPro.Composition.SetBodyPageUsage("DollarAmountOne", true);
}
else if (Field("DollarAmount") == "") {
FusionPro.Composition.SetBodyPageUsage("LessThanOneDollar", true);
}
else {
FusionPro.Composition.SetBodyPageUsage("SingleDigitPricingLayout", true);
}
}
else if (Field("UnitOfSale") == "2 For") {
if (Field("DollarAmount") >= 20) {
FusionPro.Composition.SetBodyPageUsage("2ForTwentyPlusPricing", true);
}
else if (Field("DollarAmount") == 11) {
FusionPro.Composition.SetBodyPageUsage("2ForDollarAmountEleven", true);
}
else if (Field("DollarAmount") >= 10) {
FusionPro.Composition.SetBodyPageUsage("2ForDoubleDigitPricing", true);
}
else if (Field("DollarAmount") == 1) {
FusionPro.Composition.SetBodyPageUsage("2ForDollarAmountOne", true);
}
else if (Field("DollarAmount") == "") {
FusionPro.Composition.SetBodyPageUsage("2ForLessThanOneDollar", true);
}
else {
FusionPro.Composition.SetBodyPageUsage("2ForSingleDigitPricing", true);
}
else if (Field("UnitOfSale") == "3 For") {
if (Field("DollarAmount") >= 20) {
FusionPro.Composition.SetBodyPageUsage("3ForTwentyPlusPricing", true);
}
else if (Field("DollarAmount") == 11) {
FusionPro.Composition.SetBodyPageUsage("3ForDollarAmountEleven", true);
}
else if (Field("DollarAmount") >= 10) {
FusionPro.Composition.SetBodyPageUsage("3ForDoubleDigitPricing", true);
}
else if (Field("DollarAmount") == 1) {
FusionPro.Composition.SetBodyPageUsage("3ForDollarAmountOne", true);
}
else if (Field("DollarAmount") == "") {
FusionPro.Composition.SetBodyPageUsage("3ForLessThanOneDollar", true);
}
else {
FusionPro.Composition.SetBodyPageUsage("3ForSingleDigitPricing", true);
}
}
__________________
Eric Smith Prepress Guru Classic Graphics FP 7.0P1d, MAC OSX 10.6.4, Acrobat 9.3.3 |
|
#3
|
|||
|
|||
|
Thank You Mr. Smith, I'll put this approach to use at once and let you know. Thanks very much for the quick reply, you rock.
Anthony Bice
__________________
Anthony Bice Pointsmith LLC - Houston, TX FP 6.2P1a, MAC OSX 10.5.8, Acrobat 9.3.2 |
|
#4
|
|||
|
|||
|
If you can change the names of your pages so they are more standardized (remove the word "layout" from the "1 For" page names and add the word "1For" to the beginning of those page names which would bring them more inline with the "2For" and "3For" pages) you could use a simplified function like this:
Code:
var pageName;
var dollarAmt = Field("DollarAmount");
var unitOfSale = Field("UnitOfSale").replace(" ","");
if (dollarAmt>=20){
pageName = "TwentyPlusPricing";
}else if (dollarAmt==11){
pageName = "DollarAmountEleven";
}else if (dollarAmt>=10){
pageName = "DoubleDigitPricing";
}else if (dollarAmt==1){
pageName = "DollarAmountOne";
}else{
pageName = "LessThanOneDollar";
}
FusionPro.Composition.SetBodyPageUsage(unitOfSale + pageName, true);
EDIT: Or rather, prices between 2 and 9 won't return a value given the original setup but would give "LessThanOneDollar" in mine. Just change it to >=1 in that test.
__________________
FusionPro 6.0P1f Desktop/Server Windows XP SP3/Windows 2003 Acrobat 8 Last edited by tobarstep; August 19th, 2009 at 10:31 AM.. |
|
#5
|
|||
|
|||
|
Thank You Both,
I am working with esmith's "Nested If" approach now. I will digest tobarstep's Fuction soon. Thanks all so much. I'm trying to slowly understand all points and implement myself rather than copying/pasting your offered solutions.
__________________
Anthony Bice Pointsmith LLC - Houston, TX FP 6.2P1a, MAC OSX 10.5.8, Acrobat 9.3.2 |
|
#6
|
||||
|
||||
|
Touché tobartep. I knew a more concise answer lay somewhere amidst all the repetitive words in the preceding solutions!
__________________
Eric Smith Prepress Guru Classic Graphics FP 7.0P1d, MAC OSX 10.6.4, Acrobat 9.3.3 |
|
#7
|
|||
|
|||
|
Oh, please don't think I was trying to one-up you
I think both approaches will work the same. It's more of a personal preference thing; I like to use variables as much as possible.
__________________
FusionPro 6.0P1f Desktop/Server Windows XP SP3/Windows 2003 Acrobat 8 |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|