MapWindow 4 - ActiveX Control Programming : MapWindow Discussion Forum
Hi im triyng to access to a shp values. I use a simple code that respect the examples given in the mapwingis web, but the get_CellValue method allways returns me an empty string. The shp file have valid data. It worked ok in the 4.6 activeX version but a few days ago i updated to de 4.8.6.0 version
Can´t access to shapefile values
Posted by: floresbatchline ()
Date: May 11, 2012 05:31AM

Hi im triyng to access to a shp values. I use a simple code that respect the examples given in the mapwingis web, but the get_CellValue method allways returns me an empty string. The shp file have valid data. It worked ok in the 4.6 activeX version but a few days ago i updated to de 4.8.6.0 version and it doesnt work now.

IM USING C++ BUILDER 6

Shapefile* pShape = Map1->get_Shapefile(nHandle);
for(int s = 0; s < pShape->NumShapes; s++)
{
	String sFieldName = "City";
	String sValue;
	for(int i = 0; i < pShape->get_NumFields(); i++)
	{
		String sName = pShape->get_Field(i)->Name;
		if(sFieldName == sName)
		{
			sValue = pShape->get_CellValue(i, s).bstrVal;
		}
	}
}

[Edit: made the code inline]



Edited 2 time(s). Last edit at 05/16/2012 03:08AM by pmeems.

Attachments: Example.txt (338 bytes)  
Re: Can´t access to shapefile values
Posted by: pmeems ()
Date: May 16, 2012 01:46AM

H Flores,

I've seen your requests about commit rights to the source code.
I've replied explaining you need to send in a few patches first.

Thanks,

Paul

--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group

Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.

---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS

Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl

*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn

Re: Can´t access to shapefile values
Posted by: floresbatchline ()
Date: May 16, 2012 02:05AM

Thanks for your atention.

Could you help directly with my problem with the get_CellValue method and the 4.8 version?

Re: Can´t access to shapefile values
Posted by: pmeems ()
Date: May 16, 2012 03:15AM

I'm not very good with C++, but looking at the docs I can't see what you are doing wrong:
[www.mapwindow.org]

What happens if you just loop through all shapes and get the value of every first field?

And I see you are looking for the index of a field, you can also use sf.table.get_FieldIndexByName(fieldname): [www.mapwindow.org]

--
Paul

--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group

Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.

---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS

Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl

*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn

Re: Can´t access to shapefile values
Posted by: floresbatchline ()
Date: May 16, 2012 03:49AM

In wich language can you access to sf.table?
Not in C++.
Thanks

Sorry, only registered users may post in this forum.





Banner Exchange




GISCP.com




Send us your banner logo (160x120) for the space above, and add this MapWindow banner ad to your site:

Just paste this text in your page: