amarsden

Find task results oddity

Discussion created by amarsden on Oct 11, 2012
Hi

I'm cyclying through the results of a find task with a line like this

for (j in results[dijit.byId('layerselect').get('value')].feature.attributes) {

To get the field names so my datagrid can be built dynamically from the results, regardless of layer the find is run against.

Sometimes this works, when it does, the attributes of each found record look like this

attributes: ObjectCHARGE_DESC: Array[1]
DATE_REGISTERED: Array[1]
INT_ID: Array[1]
OBJECTID: Array[1]
REFERENCE: Array[1]
REGISTER_ID_VERSION: Array[1]
REGISTER_PART: Array[1]
SHAPE: Array[1]
_0: 0
_RI: true
_S: a
xx: Array[1]




With the field values stored as arrays.

When it fails, usually when only one thing is found it looks like this


attributes: Object


DATE_REGISTERED: "20/11/1984"

INT_ID: "191702"

OBJECTID: "7137"

REFERENCE: "S215N/002/SIDM"

REGISTER_ID_VERSION: "1"

REGISTER_PART: "3B"

SHAPE: "Polygon"

xx: "9"

__proto__: Object





With the field attributes just as text strings.  my code then breaks with

TypeError

arguments: Array[2]

get message: function () { [native code] }

get stack: function () { [native code] }

set message: function () { [native code] }

set stack: function () { [native code] }

type: "non_object_property_load"

__proto__: Error




Any ideas?  Or even an easier way to return all the field names of a found record?

Cheers

ACM

Outcomes