PDA

View Full Version : On Call Page Selection


kopytekinc
July 8th, 2010, 10:09 AM
I have an odd bit where I need to select from different pages dependant on a variable or 2 in the data, my current rule reads as this

if (Field("PC_USED") = "Court Reporting Institute of Houston")

CardFront = "Court Reporting Institute of Houston" + "-front";
CardBack = "Court Reporting Institute of Houston" + "-back";

FusionPro.Composition.SetBodyPageUsage(CardFront,t rue);
FusionPro.Composition.SetBodyPageUsage(CardBack,tr ue);

else if (Field("PC_USED") = "Court Reporting Institute of Dallas"

CardFront = "Court Reporting Institute of Dallas" + "-front";
CardBack = "Court Reporting Institute of Dallas" + "-back";

FusionPro.Composition.SetBodyPageUsage(CardFront,t rue);
FusionPro.Composition.SetBodyPageUsage(CardBack,tr ue);

else

CardFront = Field("DESC") + "-front";
CardBack = Field("DESC") + "-back";

FusionPro.Composition.SetBodyPageUsage(CardFront,t rue);
FusionPro.Composition.SetBodyPageUsage(CardBack,tr ue);

What this should do is, if the case is met for Either Court Reporting Institute of Dallas or Houston in the PC_USED field, they would get use the pages listed, while the rest of the cards would use the DESC field to determine the pages used. Clearly I am missing something with my if statements just cant sort what. Thanks for the help

LesSjo
July 8th, 2010, 10:17 AM
You seem to be missing some parens and brackets, but without knowing what your pages are named, I can't say that is all that is wrong, but it should get you closer.

if (Field("PC_USED") = "Court Reporting Institute of Houston") {

CardFront = "Court Reporting Institute of Houston" + "-front";
CardBack = "Court Reporting Institute of Houston" + "-back";

FusionPro.Composition.SetBodyPageUsage(CardFront,t rue);
FusionPro.Composition.SetBodyPageUsage(CardBack,tr ue);
}
else if (Field("PC_USED") = "Court Reporting Institute of Dallas") {

CardFront = "Court Reporting Institute of Dallas" + "-front";
CardBack = "Court Reporting Institute of Dallas" + "-back";

FusionPro.Composition.SetBodyPageUsage(CardFront,t rue);
FusionPro.Composition.SetBodyPageUsage(CardBack,tr ue);
}
else {

CardFront = Field("DESC") + "-front";
CardBack = Field("DESC") + "-back";

FusionPro.Composition.SetBodyPageUsage(CardFront,t rue);
FusionPro.Composition.SetBodyPageUsage(CardBack,tr ue);
}

Hope it helps.

kopytekinc
July 8th, 2010, 10:58 AM
Looks cleaner and more like where I was going, but unfort now I get a new error that I am unsure of its reasoning, says Invalid Assignment left hand side.

This is a callback rule to run on job start

LesSjo
July 8th, 2010, 11:16 AM
duh.

if (Field("PC_USED") == "Court Reporting Institute of Houston") {

CardFront = "Court Reporting Institute of Houston" + "-front";
CardBack = "Court Reporting Institute of Houston" + "-back";

FusionPro.Composition.SetBodyPageUsage(CardFront,t rue);
FusionPro.Composition.SetBodyPageUsage(CardBack,tr ue);
}
else if (Field("PC_USED") == "Court Reporting Institute of Dallas") {

CardFront = "Court Reporting Institute of Dallas" + "-front";
CardBack = "Court Reporting Institute of Dallas" + "-back";

FusionPro.Composition.SetBodyPageUsage(CardFront,t rue);
FusionPro.Composition.SetBodyPageUsage(CardBack,tr ue);
}
else {

CardFront = Field("DESC") + "-front";
CardBack = Field("DESC") + "-back";

FusionPro.Composition.SetBodyPageUsage(CardFront,t rue);
FusionPro.Composition.SetBodyPageUsage(CardBack,tr ue);
}also, this should probably be used in an onRecordStart rule, not an nJobStart rule...

kopytekinc
July 8th, 2010, 11:40 AM
Yep, was setup on RecordStart and of course == such a simple thing, thanks for the help.