In a DCT, I have multiple items that contain state values. In the PT, I need to create a metadata tag with a list of states. I want to read all the items that have state values and create an array of state values. I don't, however, want to have duplicate values in the array. Here's the perl code I have to create the array, but I don't know how to ensure that I don't have the same state value listed twice.
<iw_perl><![CDATA[
$regs1 = iwpt_dcr_value('dcr.Region.Region1');
for ($i=0; $i<15; $i++)
{
$reg1[$i] = iwpt_dcr_value('dcr.Region.Region1[$i]');
if ($reg1[0] eq 'ALL')
{
push@{regionarray},MA;
}
else
{
push @{regionarray},
@reg1[$i];
}
}
$regs2 = iwpt_dcr_value('dcr.Region.Region2');
for ($i=0; $i<15; $i++)
{
$reg2[$i] = iwpt_dcr_value('dcr.Region.Region2[$i]');
if ($reg2[0] eq 'ALL')
{
push @{regionarray},IL,IN,MI,MN,OH,WI;
}
else
{
push @{regionarray},
@reg2[$i];
}
}
if(iwpt_dcr_value('dcr.State') ne '')
{
for ($s=0; $s<43; $s++)
{
$state[$s] = iwpt_dcr_value('dcr.State[$s]');
push @{regionarray},$state[$s];
}
}
$regions = join ",",
@regionarray;
]]></iw_perl>
All suggestions are greatly appreciated.
Thanks