OL Learn

Multiple regions don't work

I’m writing a script in my datamapper(under bounderies) to split a pdf file into multiple records, based on information in my input pdf. But for some reason I can’t make multiple make multiple create regions like this.

var region = region.createRegion(59.943996,100,77.724,98);
var textInRegion = boundaries.get(region).join();
var region2 = region.createRegion(193.379, 616.035, 210, 613);
var landScapeCheck = boundaries.get(region2);
var region3 = region.createRegion(25, 59, 42 ,55 );
var olaCheck = boundaries.get(region3);

Whichever one is first in line works, but the rest doesn’t. Anyone have a idea what’s going on?

Works fine here. But I notice you use join() with your first region, which effectively makes textInRegion a string variable while landScapeCheck and olaCheck remain arrays of strings. Could it be that the way you use all of those variables later in your script relies on all of them being of the same type?

I get an error on the second region whether I use the join() or not; ‘cannot find default value for object.’ Even when I turn all lines except for the ones in the example into comments I still get an error on the second createRegion.

Sorry for the late reply, I was on vacation.

This will be difficult to debug without seeing your actual data file, but since you probably shouldn’t be sharing that on the web, I would suggest you open a call with our Support team so they can take a look at it.

just to add the solution found during a Support session:

The variable definition "var region = " is causing the issue because it’s overwriting the Datamapper region object, changing the variable name to “region1” resolves it.


Duhhh… I should have noticed that.
Glad someone found it, though!