Hi all
Got a curly one.
First we ask on what hours someone does something (24 slots).
Then we ask, for each of the slots, the number of times they did it (occasions)
Then for each of those occasions, we ask a category, and for certain categories we also ask a brand.
So there is a lot being asked. I have the outer loop (running from the slots they used to the end of the brand list) as B3Outer and the other one running inside it (from the number of occasions to the end of the brand list) as B3Inner.
THEN I need to assign each of the 24 hour slots into dayparts (morning, mid-morning, afternoon, etc.
THEN I choose one of these dayparts for which they have filled in a time slot (least fill). Having chosen this, I go back and randomly select one of the hourly slots they filled in that fit that daypart. Then I need to choose one of the occasions within that hourly slot and extract the category, and if applicable, the brand.
Here is the code I wrote to try to choose an occasion within the hour slot:
Begin Unverified Perl
my $hour = VALUE("OccasionHour");
my $i = 0;
for($i = 1; $i <= 24; $i++)
{
if($hour == $i && VALUE("B3a."$i) == 1)
{
ADD("B3aList",1);
}
elsif($hour == $i && VALUE("B3a."$i) == 2)
{
ADD("B3aList",1,2);
}
else
{
ADD("B3aList",1,3);
}
}
End Unverified
Randomize()
ListMax(1)
It falls over. And the database is so big I can't even get into the admin module to see what is happening (which is another problem entirely).
Can anyone help? I'm on 9.10.1