Using perl in CBC conditional pricing

Hi all

I haven't had much experience in the CBC module, but I've got a study to set up and it's a doozy!

Here's the thing:

17 brands (they see the brand they choose outside the model)
5 pack sizes (the packs they see are based on the brand - some have 4, some have 2)
Prices (This equals Base price + a price determined by the level (3 levels) + a loading if they are a regional customer , also set outside the model).

The statistician has given me a design to import, and I plan on displaying it using freeformat.

SO! I have determined that the brands can be bunched up into the same price structure and packs to be shown, so thinking I should create a separate model for each "bunch" to take some of the complication out of the mix.

That just leaves the price to be displayed. Was thinking that I should set up conditional pricing. Can I use perl for this? Was thinking of something like this:


[% Begin Unverified Perl
my $base = 4.10;
my $generic = HOW DO I DO THIS BIT?
my $region = 0.20;
my $level = -0.20;

if(VALUE("MetroRegional") == 1)
{
$base = $base + $level;
}
else
{
$base = $base + $level + $region;
}

return $base;
End Unverified %]


Would this work? How do I access the Generic attribute?

I have these attributes and levels:
Size (pack 1, pack 2, pack 3, pack 4)
Price (Level 1, Level 2, Level 3)
Generic (Level 1, Level 2, Level 3)

Resolved
5 replies