PDA

View Full Version : Is there a data size limit when using the 'ImportData' method?



Swoop
03-01-2013, 10:49 AM
This has been driving me nuts all afternoon.

I've got a macro which will cycle through a list of engineers and plot their points of work on individual maps, saving each one named as per the engineer in question....it works well. However, I've been trying to plot all jobs from a 'MasterJobList' in the same manner as per the individual engineers and it's been failing constantly with: "Cannot find the specified data source moniker".

I've tried everything to figure out why but have just discovered that if I manually set the range to a low number (like 50 or so rows) then it'll work fine.....if I let Excel decide the range (1163 total rows) then it fails with can't find data source.




Savefile = "C:\temp\testfile.xls"
zDataSource = savefile & "!MasterJobList!N2:N" & range("MasterJobList!A65000").end(xlup).row

objApp.OpenMap saveloc & "Patches.ptm"
set objDataSets = objApp.ActiveMap.DataSets
set objDataSet = objDataDets.ImportData(zDataSource)

Eric Frost
03-02-2013, 09:15 AM
If you "manually" set the range to 1163 then it also fails?

I haven't seen this issue before so I'd probably have to play with it in order to help you troubleshoot. Is it something you can zip and post?

Eric

Swoop
03-05-2013, 07:06 AM
Cut down version attached. Exhibits the same error as the main .xls.......in the macro use the variable MPMJ (integer) to specify how many rows of data to attempt to map. Anything over around 200 fails.

Swoop
03-05-2013, 09:43 AM
Further testing:

It's not the number of rows of data that is the problem, it's the end row of the dataset. If the last row of the dataset is higher than row number 256 then it'll fail. ie, if I import data with the following datasource:

zDatasource = fileloc & "!MasterJobList!N1:N255"

then it'll work just fine. However, if I try:

zDatasource = fileloc & "!MasterJobList!N100:N257"

then it'll fail with cannot find datasource monika.



The letters WTF spring to mind.


And after even more testing.....if I name a range within the workbook and import that named range then it works fine every time......which does supply me with a solution but now means I've gotta code an all encompassing named range management system to create, change and clear up named ranges on the fly.

Eric Frost
03-05-2013, 10:00 AM
Wow, good testing, sorry I didn't get a chance to play with this yet.

I didn't notice this before, but if I may ask, why is it only a single column N

zDatasource = fileloc & "!MasterJobList!N1:N257"

Shouldn't it be something like

zDatasource = fileloc & "!MasterJobList!A1:N257"

?

Swoop
03-05-2013, 10:34 AM
Heh, I was going to say no cos the only thing I actually want to map in the dataset is a pushpin placed where the postcode is.

However......after another test, if I do specify a larger data set (M1:N1000) then it works.

Again, the letters WTF spring to mind. :-)

Eric Frost
03-05-2013, 01:09 PM
Haha, so problem solved?

Eric

Swoop
03-06-2013, 02:47 AM
I think I worked out what's going on.

MapPoint can handle 255 data items of the same name. If data is imported with no name field (or other identifying field) then MapPoint auto name's everything the same name.....and runs out of address space at 255. Therefore, importing 2 fields with one as location and the other as an identifier.....it doesn't run out of address space.

Although that's all just a guess.

Eric Frost
03-06-2013, 06:49 PM
It seems I've seen this before, one day in a MapPoint training class or something. Maybe that's why I mentioned the observation above.

Fairly obscure maybe, but in any case, do you think is qualifies as a bug and we should add to this thread?

http://www.mapforums.com/mappoint-2013-bugs-errors-solutions-27627.html

Swoop
03-07-2013, 03:11 AM
No no, it's not a bug.....it's a feature. Is what Microsoft would say I'm sure. :)

Eric Frost
03-07-2013, 07:19 AM
Fair enuf, LOL