I am new to ArcObjects
In above attribute table I write query to select "0" in all fields. After I get cursor for looping selected features.but my problem is I want show the FID number and field name which contain "0" attribute values as a message.
for example I want output like:
( fid ,field name
10,NAME
30,NAME
30,FIRST_CONT.........
)
here mycode
ESRI.ArcGIS.ArcMapUI.IMxDocument mxd = ArcMap.Application.Document as ESRI.ArcGIS.ArcMapUI.IMxDocument;
ESRI.ArcGIS.Carto.IMap map = mxd.FocusMap;
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory wsf= new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactory();
ESRI.ArcGIS.Geodatabase.IWorkspace ws= wsf.OpenFromFile(@"D:\ARC OBJECTS", ArcMap.Application.hWnd);
ESRI.ArcGIS.Geodatabase.IFeatureWorkspace fws = ws as ESRI.ArcGIS.Geodatabase.IFeatureWorkspace;
ESRI.ArcGIS.Geodatabase.IFeatureClass fcls = fws.OpenFeatureClass("Find_null");
ESRI.ArcGIS.Geodatabase.IQueryFilter qf = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
qf.WhereClause = "FID_1 = 0 OR NAME = '0' OR POPULATION = 0 OR FIRST_CONT = '0'";
ESRI.ArcGIS.Geodatabase.IFeatureCursor fcur = fcls.Search(qf, true);
ESRI.ArcGIS.Geodatabase.ICursor cur=fcur as
ESRI.ArcGIS.Geodatabase.ICursor;
ESRI.ArcGIS.Geodatabase.IRow row= cur.NextRow();
while (row!=null)
{
row= cur.NextRow();
}
asked Jan 31, 2018 at 20:54
-
Can you edit your answer to show exactly what you want as output? NAME// does not exist in any of your rows. It is unclear what you are asking.Hornbydd– Hornbydd2018年01月31日 21:54:07 +00:00Commented Jan 31, 2018 at 21:54
-
NAME IS field name. .....i want fid number, field aliase nameVelugoti Venkateswarlu– Velugoti Venkateswarlu2018年02月01日 11:14:56 +00:00Commented Feb 1, 2018 at 11:14
1 Answer 1
I would use something like below. Here is some VB code and basic idea of logic.
dim fid... and other variables
pRow = pCursor.NextRow
Do while not pRow is Nothing
fid1 = pRow.Value(pRow.FindField("FID_1")
If pRow.Value(pRow.FindField("NAME")) = "0" Then
bName = True
End If
If pRow.Value(pRow.FindField("POPULATION")) = 0 Then
bPop = True
End If
' Also FIRST_COUNT
If bName Then
Debug.Print Cstr(fid) + ",NAME"
End If
If bPop Then
Debug.Print Cstr(fid) + ",POPULATION"
End If
pRow = pCursor.NextRow
Loop
answered Feb 1, 2018 at 14:46
lang-cs