dataRecord.get / calling an unmatched pattern

i've got the following problem.
I am scraping listings. They all have a different number of images.

The problem is that if a listing has 4 images, and a previous one has 5,
the session variable from the previous listing is also used for the next.

The method is [i]apply pattern after each pattern application[/i].

So i am trying to do this in a script:

if(dataRecord.get( "image5" ) == "" )
{
session.setVariable( "image5", null );
}
// call the Save scrape
session.scrapeFile( "Save_images" );

But what ever i try, nothing seems to work. The log indicates:
Scrape_images: Extracting data for pattern "image5"
Scrape_images: The pattern did not find any matches.

But: Scrape_images: POST data: still posts the image5
from the previous listing.

Anyone can help?

dataRecord.get / calling an unmatched pattern

Hi todd,

just send you the xml.
Thanks again for taking a look at this!

dataRecord.get / calling an unmatched pattern

Hi,

I'm having some trouble picturing what you're describing. Is there any chance you could send me your scraping session so I could look more closely for you? My email address is my first name at screen-scraper.com.

Thanks,

Todd Wilson