<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FeatureLayer : Without ObjectId Field? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3828#M361</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;How would adding a unique key be a surrogate?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;That's the correct terminology to use when employing this mechanism, what would you call it? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Fulfilling the requirements for specific functionality isn't a hack.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Within this use case, I don't think an OID is required for any specific functionality per se, I think it's because an assumption has been made in the the FeatureLayer class code that an OID will be there, therefore I'd be employing at least a 'workaround', perhaps 'hack' is too strong a term, but it's my (subjective) opinion!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;We don't explicitly document that an object ID is required&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, I agree that &lt;/SPAN&gt;&lt;STRONG&gt;conceptually&lt;/STRONG&gt;&lt;SPAN&gt; one shouldn't be &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;always&lt;/SPAN&gt;&lt;SPAN&gt; required but it appears the developer(s) thought otherwise.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;but it is implied in that the main use case for feature layers is using data from ArcGIS Server.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Non sequitur - I disagree that that implies that an OID is mandatory, in fact I interpret that to mean if you can publish data via AGS then you can simply point the FeatureLayer at the layer within that AGS service and it will work, the two components are fully compatible with each other.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think many of your other customers would view this the same way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;As you've outlined, it's possible to publish data with AGS that doesn't have an object ID.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Absolutely, with no warnings etc. in fact the only warnings I see are in ArcMap when it tells me there's some restricted functionality to do with selections etc. since I don't want or need to do any selections this appears irrelevant to my usage.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;We'll update the docs.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I think it'd be a pity to take that approach, why not just enhance the FeatureLayer a little so it can cope with data that don't have an OID?&amp;nbsp; (seems odd that all the other layer types can cope and this one can't, maybe it needs another 'mode' like 'MODE_RENDERONLY'!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AGS returns all the features in the JSON response just fine without the use of an OID, I would expect the FeatureLayer to at least be able to render them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is digressing a little, but for 'fun' I've overridden ('hacked' I suppose!) the _drawFeatures method in the _OnDemandMode class so that it submits the loop index as the OID argument to the _addFeatureIIf method if the OID is undefined, that way the _addFeatureIIf method doesn't use a 'value' of undefined as the key to the featureMap - this bit explains why people only see one feature rendered in this scenario i.e. the same key value of undefined is attributed to every feature therefore in the _addFeatureIIf it looks like all subsequent features (after the first one as been added) have already been added to the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found more topics than this the other day, will post the links if I find them again:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;&lt;A href="http://forums.arcgis.com/threads/31744-Feature-Layer-based-on-X-Y-Event-Layer"&gt;http://forums.arcgis.com/threads/31744-Feature-Layer-based-on-X-Y-Event-Layer&lt;/A&gt;&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&lt;A href="http://forums.arcgis.com/threads/34890-Points-not-displaying-when-ON_DEMAND-mode-is-used"&gt;http://forums.arcgis.com/threads/34890-Points-not-displaying-when-ON_DEMAND-mode-is-used&lt;/A&gt;&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;BR /&gt;&lt;SPAN&gt;With this in place all my features are rendered, but I have no idea what effects, probably negative, this will have on other functionality within the layer, it's far too risky to use for real, unless someeone can tell me otherwise!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd rather try to do things in a standard way...which probably means introducing a surrogate key, the thing is the underlying data are temporal, dynamic, rotating and vary in volume of throughput, I realise it will take a long time to 'run out' of numbers but it's still conceptually 'dirty'!&amp;nbsp; (yes, I can put something in place to re-seed the identity when it hits the limit etc. etc.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Back to the matter at hand...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;A couple more questions:&amp;nbsp; what's the mode for your feature layer? What kind of things are you wanting to do client side?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;1)&amp;nbsp; At present I don't specify a mode so it should default to MODE_ONDEMAND&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2)&amp;nbsp; Simple stuff really, I need to trigger some functionality as each feature is added to the layer, and that bit works fine....provided all the features render!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Apr 2012 07:27:30 GMT</pubDate>
    <dc:creator>__Rich_</dc:creator>
    <dc:date>2012-04-04T07:27:30Z</dc:date>
    <item>
      <title>FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3807#M340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've got a layer within an AGS service that returns a load of point features based on dynamically changing data held in a non-spatial database via an ODBC connection, I'd like to connect a FeatureLayer to the service but it only renders a single feature in the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can see from some investigations that the ESRI JavaScript relies (very heavily) on there being one field in the data that can be used as the 'ObjectIdField' to uniquely identify rows, there isn't an appropriate field in my data and I don't really want to arbitrarily generate something for these data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone found a way around this restriction?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 12:22:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3807#M340</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-04-02T12:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3808#M341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try using a Query Layer to load the data into your MXD. Go to File -&amp;gt; Add Data -&amp;gt; Add Query Layer, connect to your database and write a query (or double-click on a table to Select *). Click "Show Advanced Options", then select one or more fields to create a unique identifier.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 12:42:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3808#M341</guid>
      <dc:creator>ChadWilcomb</dc:creator>
      <dc:date>2012-04-02T12:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3809#M342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Try using a Query Layer to load the data into your MXD. Go to File -&amp;gt; Add Data -&amp;gt; Add Query Layer, connect to your database and write a query (or double-click on a table to Select *). Click "Show Advanced Options", then select one or more fields to create a unique identifier.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the response, Chad - looks like it might work, I don't suppose you know where it stores the connection info?&amp;nbsp; I'm going to need to move the mxd to an AGS machine on a different network that hasn't got ArcDesktop installed so being able to re-map connections is a must, in the past I've achieved this using ODBC DSNs etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit: found the .qcf file....it doesn't look portable!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 13:17:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3809#M342</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-04-02T13:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3810#M343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ArcCatalog connection information is usually kept in the hidden appdata folder for that user.&amp;nbsp; With 10, you can now copy and paste the database connection item in the ArcCatalog data tree and paste it where you want it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 13:25:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3810#M343</guid>
      <dc:creator>PaulBushore</dc:creator>
      <dc:date>2012-04-02T13:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3811#M344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;ArcCatalog connection information is usually kept in the hidden appdata folder for that user.&amp;nbsp; With 10, you can now copy and paste the database connection item in the ArcCatalog data tree and paste it where you want it.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, Paul.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yep, I've made use of that with .odc files in the past but it would appear that a connection created via "Add Query Layer" is a different kettle of fish, seems to have placed the connection information in a .qcf file which is presumably referenced by the mxd and cannot be moved.&amp;nbsp; Even if I could move it I'd have to go around naming all database host machines with the same name etc. or purchase a bucketload of ArcDesktop licenses for each AGS machine on each network!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 13:37:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3811#M344</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-04-02T13:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3812#M345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Progress...maybe.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Created as per the 'wizard' then remapped data sources to .odc connection which in turn uses an ODBC DSN, deleted .qcf file and the data still display...so dependency on .qcf removed....I think.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; ODBC DSN can be created anywhere, to point wherever I want&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp; .odc file can be created and copied to known location and references ODBC connection by its DSN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.&amp;nbsp; mxd can be copied to known location and references .odc at known location thus can be connected to whatever server I want&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Assuming, that's all valid, it can work...just a bit (very, very) convoluted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next problem is that the resultant layer won't accept simple definition queries e.g. Year(mydatetimefield) = 2012&amp;nbsp; "Failed to parse the where clause"!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suppose I'll have to write all the queries in step 1 i.e. when adding the query layer!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Blimey.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:03:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3812#M345</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-04-02T14:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3813#M346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What's the reasoning behind not wanting to add an object id field client side?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:21:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3813#M346</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-04-02T14:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3814#M347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually, scratch all that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The step "Add Query Layer" that asks you to select the unique identifier fields is a problem, actually it's the original problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are no fields in this dataset that consitute a unique identifier, it's the nature of the data.&amp;nbsp; If I choose a field or a composite of fields then effectively I'll be filtering out data because ArcDesktop will assume they're dusplicate records because they have matching 'key' values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just want the software to plot the points in the database, all of them.&amp;nbsp; AGS renders them all in the images it produces and it also provides them in the JSON is returns, it's just the client-side FeatureLayer code that lets the side down and unfortunately I need other parts of its functionality.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the responses but it looks like this is a dead end.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:26:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3814#M347</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-04-02T14:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3815#M348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What's the reasoning behind not wanting to add an object id field client side?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Derek, do you have any samples on how to do this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:30:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3815#M348</guid>
      <dc:creator>ChadWilcomb</dc:creator>
      <dc:date>2012-04-02T14:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3816#M349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's simple to add a unique field to your data client side. You can do it with three lines of code, something like: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.forEach(data, function(d, idx) {
&amp;nbsp; d.attributes.oid = idx;
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And in your feature collection, make sure your field named oid (or whatever you choose to name it) has a type of esriFieldTypeOID.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:09:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3816#M349</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2021-12-10T20:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3817#M350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What's the reasoning behind not wanting to add an object id field client side?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Derek,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where would I add it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would I need to intercept the query response and append the list of fields etc?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rich&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:33:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3817#M350</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-04-02T14:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3818#M351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Derek, do you have any samples on how to do this?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, no samples to show manually populating an object ID. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rather than populating a unique ID yourself, an alternative is to use applyEdits to push your data into the feature layer. This is what the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/fl_featurecollection.html"&gt;feature layer from feature collection&lt;/A&gt;&lt;SPAN&gt; sample does with data returned from flickr that does not have a unique identifier.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:34:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3818#M351</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-04-02T14:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3819#M352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;It's simple to add a unique field to your data client side. You can do it with three lines of code, something like: &lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.forEach(data, function(d, idx) {
&amp;nbsp; d.attributes.oid = idx;
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;And in your feature collection, make sure your field named oid (or whatever you choose to name it) has a type of esriFieldTypeOID.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Where would that forEach sit?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:09:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3819#M352</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2021-12-10T20:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3820#M353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The forEach would run after you've retrieved your data but before you create your feature layer. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since it sounds like you're not using a layer from a map service, I assumed your creating a feature layer from a feature collection. Are you using a feature collection?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3820#M353</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-04-02T14:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3821#M354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The forEach would run after you've retrieved your data but before you create your feature layer. &lt;BR /&gt;&lt;BR /&gt;Since it sounds like you're not using a layer from a map service, I assumed your creating a feature layer from a feature collection. Are you using a feature collection?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nope, the data are from an AGS map service...which is why I'm surprised that this does not 'just work' out of the box.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:38:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3821#M354</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-04-02T14:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3822#M355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Nope, the data are from an AGS map service...which is why I'm surprised that this does not 'just work' out of the box.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In that case, it's best to add your unique ID on the server. Does the layer have a primary key? Are you able to make selections against it in ArcMap?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:43:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3822#M355</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-04-02T14:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3823#M356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;In that case, it's best to add your unique ID on the server. Does the layer have a primary key? Are you able to make selections against it in ArcMap?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I can query against the source in ArcMap, specifically I'm doing some DateDiff stuff to limit the results.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The nature of the data means it would be dangerous to choose a key from actual data fields as it would remove records that in reality are not duplicates.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:47:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3823#M356</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-04-02T14:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3824#M357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I can query against the source in ArcMap, specifically I'm doing some DateDiff stuff to limit the results.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hmm, I'm surprised to hear that. Can you talk a bit more about your data source? How is the data added to ArcMap? What's the data store being used for this data?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The nature of the data means it would be dangerous to choose a key from actual data fields as it would remove records that in reality are not duplicates.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In that case, can you have your database auto-populate a unique field? All the main RDBMS's have this capability but you would probably have to create a new table and reload your data.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:52:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3824#M357</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-04-02T14:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3825#M358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Will post more info tomorrow, bit too much to type on a phone!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 15:09:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3825#M358</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-04-02T15:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer : Without ObjectId Field?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3826#M359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hmm, I'm surprised to hear that. Can you talk a bit more about your data source? How is the data added to ArcMap? What's the data store being used for this data?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Me too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The data source is an XY Event Source, underlying that is a .odc file (created with ArcCatalog) that uses an ODBC DSN which in turn uses the SQL Server Native Client library to connect to a SQL Server instance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But you don't need all that to reproduce the scenario, you could get to this point using a simple CSV file like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
long,lat,message
1,1,hello world
2,2,hello again world
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;In that case, can you have your database auto-populate a unique field? All the main RDBMS's have this capability but you would probably have to create a new table and reload your data.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Creating a surrogate key where it's appropriate for the data is acceptable, but in this case it'd be a hack, the (identity) value would have no 'meaning' to the data values etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The underlying issue is that although the FeatureLayer JS knows that the data has no OID value (and logs this fact to the console) it continues to try and use it as a key to the data, I can point you towards the method(s) in the class where this causes issues if that helps?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I understand the need for a key to identify data if, for example, I was providing some editing of persistable features, but in this case all I want to do is display the features in the map, just like the ArcGISDynamicServiceLayer would, but because I need some client-side functionality not available with an image-based layer type the FeatureLayer appeared to be the best choice....apart from this (rather severe) issue!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:09:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-without-objectid-field/m-p/3826#M359</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2021-12-10T20:09:30Z</dc:date>
    </item>
  </channel>
</rss>

