<?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 Field Calculator help - just how numbers in ArcGIS GeoEvent Server Questions</title>
    <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/field-calculator-help-just-how-numbers/m-p/227415#M991</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have an incoming event definition which has a site name.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the output from a TCP output connector:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Received Event : HITS,&lt;STRONG&gt;210142-US Kewell&lt;/STRONG&gt; Ck,30/04/2014 00:15:00,0.672,0.0,á,á,á&lt;BR /&gt;Received Event : HITS,&lt;STRONG&gt;210137-Wangat&lt;/STRONG&gt;,29/04/2014 23:00:00,0.268,18.0,á,15.5,á&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my featureclass, I only have a siteID, so for the above two, it would be 210142 and 210137.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is always a 6 digit number. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Therefore, I figured this would be a good example of how a field calculator would be able to either&lt;/SPAN&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Trim the string to just show the first 6 characters&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Strip the string down to just show numbers (using regex)&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;BR /&gt;&lt;SPAN&gt;I decided to go for the second option.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]33442[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, this just returns empty values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Received Event : HITS,,29/04/2014 23:30:00,0.356,13.7,á,á,á&lt;BR /&gt;Received Event : HITS,,29/04/2014 23:45:00,0.668,42.520,á,á,á&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried various alternatives to the regex pattern, but it always gives blank values.&amp;nbsp; Is this because the incoming event is a string and therefore there is no numbers?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, in priority order:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;How would you solve this with approach #2&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;How would you solve it with approach #1&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Bonus points for helping me convert those incoming blank values which are coming in from the &lt;A href="http://pipes.yahoo.com/pipes/pipe.run?_id=7892c39c1778e81c27aeb4a0ba265623&amp;amp;_render=json"&gt;input feed&lt;/A&gt; as \u00a0 and ending up being á.&amp;nbsp; Not sure what happens when I throw these at a double field in my feature class, might not matter.&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Apr 2014 13:51:51 GMT</pubDate>
    <dc:creator>SimonJackson</dc:creator>
    <dc:date>2014-04-29T13:51:51Z</dc:date>
    <item>
      <title>Field Calculator help - just how numbers</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/field-calculator-help-just-how-numbers/m-p/227415#M991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have an incoming event definition which has a site name.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the output from a TCP output connector:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Received Event : HITS,&lt;STRONG&gt;210142-US Kewell&lt;/STRONG&gt; Ck,30/04/2014 00:15:00,0.672,0.0,á,á,á&lt;BR /&gt;Received Event : HITS,&lt;STRONG&gt;210137-Wangat&lt;/STRONG&gt;,29/04/2014 23:00:00,0.268,18.0,á,15.5,á&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my featureclass, I only have a siteID, so for the above two, it would be 210142 and 210137.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is always a 6 digit number. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Therefore, I figured this would be a good example of how a field calculator would be able to either&lt;/SPAN&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Trim the string to just show the first 6 characters&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Strip the string down to just show numbers (using regex)&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;BR /&gt;&lt;SPAN&gt;I decided to go for the second option.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]33442[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, this just returns empty values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Received Event : HITS,,29/04/2014 23:30:00,0.356,13.7,á,á,á&lt;BR /&gt;Received Event : HITS,,29/04/2014 23:45:00,0.668,42.520,á,á,á&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried various alternatives to the regex pattern, but it always gives blank values.&amp;nbsp; Is this because the incoming event is a string and therefore there is no numbers?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, in priority order:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;How would you solve this with approach #2&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;How would you solve it with approach #1&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Bonus points for helping me convert those incoming blank values which are coming in from the &lt;A href="http://pipes.yahoo.com/pipes/pipe.run?_id=7892c39c1778e81c27aeb4a0ba265623&amp;amp;_render=json"&gt;input feed&lt;/A&gt; as \u00a0 and ending up being á.&amp;nbsp; Not sure what happens when I throw these at a double field in my feature class, might not matter.&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2014 13:51:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/field-calculator-help-just-how-numbers/m-p/227415#M991</guid>
      <dc:creator>SimonJackson</dc:creator>
      <dc:date>2014-04-29T13:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator help - just how numbers</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/field-calculator-help-just-how-numbers/m-p/227416#M992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Simon -&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the problem is with the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Field Calculator (Regular Expression)&lt;/SPAN&gt;&lt;SPAN&gt; processor's configuration.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Looking at your screenshot, the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Field Name&lt;/SPAN&gt;&lt;SPAN&gt; has been specified as:&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;Site&lt;/STRONG&gt;&lt;SPAN&gt;.&amp;nbsp; When using the "regular" &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Field Calculator&lt;/SPAN&gt;&lt;SPAN&gt; processor, field names are expressed without decoration. When using the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Field Calculator (Regular Expression)&lt;/SPAN&gt;&lt;SPAN&gt; processor you need to enclose field names in curl-braces and prepend a '$' ... so your configuration needs to specify &lt;/SPAN&gt;&lt;STRONG&gt;${Site}&lt;/STRONG&gt;&lt;SPAN&gt; rather than just &lt;/SPAN&gt;&lt;STRONG&gt;Site&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a common source of confusion. With the 10.2.2 product release the "regular" &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Field Calculator&lt;/SPAN&gt;&lt;SPAN&gt; processor will accept Java String functions - some of which accept RegEx expressions. Hopefully this will reduce the need to use the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Field Calculator (Regular Expression)&lt;/SPAN&gt;&lt;SPAN&gt; processor ... and help eliminate the confusion in how the two processors expect event field names be specified.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, if you are using 10.2.2 you could configure a "regular" &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Field Calculator&lt;/SPAN&gt;&lt;SPAN&gt; processor with an expression like &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;replaceAll(fieldName,'[-].*','')&lt;/SPAN&gt;&lt;SPAN&gt; to identify and replace all characters following a literal '-' with an empty string. That would effectively trim SiteId-SiteName expression down to just the 6-digit SiteId.&amp;nbsp; (You could also use the substring() function to grab just the first six characters of the SiteId-SiteName expression ... something like &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;substring(fieldName,0,6)&lt;/SPAN&gt;&lt;SPAN&gt;.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are using 10.2.1 you won't have support for Java String functions. In that case you'll have to stick with the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Field Calculator (Regular Expression)&lt;/SPAN&gt;&lt;SPAN&gt; processor, specify the field name ${Site}, use a RegEx pattern like ^[0-9][0-9]*, and either place the substring into a new field (allowing you to specify that it is an Integer or Long) ... or overwrite the existing Site field value with the substring as a string representation of the SiteId.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2014 19:12:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/field-calculator-help-just-how-numbers/m-p/227416#M992</guid>
      <dc:creator>RJSunderman</dc:creator>
      <dc:date>2014-04-29T19:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator help - just how numbers</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/field-calculator-help-just-how-numbers/m-p/227417#M993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Simon -&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;Polling the feed you indicated:&amp;nbsp; [url=&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://pipes.yahoo.com/pipes/pipe.run?_id=7892c39c1778e81c27aeb4a0ba265623&amp;amp;_render=json]http://pipes.yahoo.com/pipes/pipe.run?_id=...&amp;amp;_render=json[/url" rel="nofollow noopener noreferrer" target="_blank"&gt;http://pipes.yahoo.com/pipes/pipe.run?_id=7892c39c1778e81c27aeb4a0ba265623&amp;amp;_render=json]http://pipes.yahoo.com/pipes/pipe.run?_id=...&amp;amp;_render=json[/url&lt;/A&gt;&lt;SPAN&gt;] it appears to me that all of the &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;items&lt;/SPAN&gt;&lt;SPAN&gt; event fields are being expressed as JSON strings, with the first item in the list advertising the expected field names. &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
:
:
items: [
{
Site: "Site",
LastSampleTime: "Last Sample Time",
RiverLevel: "River Level",
FlowRate: "Flow Rate",
RainfallIntensity: "Rainfall Intensity",
WaterTemp: "Water Temperature",
Conductivity: "Conductivity",
description: null,
title: null
},
{
Site: "210001-Singleton",
LastSampleTime: "30/04/2014 05:57:56",
RiverLevel: "0.652",
FlowRate: "400.2",
RainfallIntensity: " ",
WaterTemp: " ",
Conductivity: " ",
description: null,
title: null
}, ...
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The GeoEvent Definition generated for me by the GeoEvent Processor input specifies that all fields are expected as String:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]33454[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I send the poll'd JSON to a GeoEvent Cache, I can review the event data as either &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Text&lt;/SPAN&gt;&lt;SPAN&gt; or &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;JSON&lt;/SPAN&gt;&lt;SPAN&gt; by visiting the appropriate REST endpoint for the cache:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;localhost:6180/geoevent/rest/cache/cache-out?f=text&lt;/LI&gt;&lt;LI&gt;localhost:6180/geoevent/rest/cache/cache-out?f=generic-json&lt;/LI&gt;&lt;/UL&gt;&lt;BR /&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;GeoEventCache&lt;/SPAN&gt;&lt;SPAN&gt; adapter used by the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Publish GeoEvents on a REST endpoint&lt;/SPAN&gt;&lt;SPAN&gt; appears to be handling the unicode string/character \u00a0 being reported when values are missing/unreported as part of the unicode extended character set.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]33455[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Text&lt;/SPAN&gt;&lt;SPAN&gt; adapter used by the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Publish text to a TCP Socket&lt;/SPAN&gt;&lt;SPAN&gt;, on the other hand, appears to be converting the "non breaking space" character ... which in HTML is &amp;amp;# 160; ... to an ASCII extended character equivalent:&amp;nbsp; á.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What you could do, to avoid having this unicode character being interpreted by different adapters, is edit the generated GeoEvent Definition to specify that the metric values are expected as type Double. The input will then attempt to cast the JSON string values it receives to Double, and set the field's value to &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;null&lt;/STRONG&gt;&lt;SPAN&gt; if the type cast fails. Might as well include the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;description&lt;/SPAN&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;title&lt;/SPAN&gt;&lt;SPAN&gt; event fields from the provided JSON, currently being reported as &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;null&lt;/STRONG&gt;&lt;SPAN&gt; strings, while you're at it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]33457[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Notice in the following illustration that in a "text" adaption of the event data, the &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;null&lt;/STRONG&gt;&lt;SPAN&gt; fields appear "empty", while in a JSON adaption of the event data the &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;null&lt;/STRONG&gt;&lt;SPAN&gt; fields are not reported.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]33459[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think this will better allow you to apply filter criteria, process events, and eventually send event data to a feature service. Better, in my opinion, to send "null" data as &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;null&lt;/STRONG&gt;&lt;SPAN&gt; than as a "non-breaking space" unicode character.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- RJ&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:04:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/field-calculator-help-just-how-numbers/m-p/227417#M993</guid>
      <dc:creator>RJSunderman</dc:creator>
      <dc:date>2021-12-11T11:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator help - just how numbers</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/field-calculator-help-just-how-numbers/m-p/227418#M994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;RJ - ask Adam for a pay rise.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Both your posts have cleaned up my output feed perfectly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I will end up making this public, so ill post back in a week or so with a Javascript Operations Dashboard link&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 06:06:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/field-calculator-help-just-how-numbers/m-p/227418#M994</guid>
      <dc:creator>SimonJackson</dc:creator>
      <dc:date>2014-05-01T06:06:20Z</dc:date>
    </item>
  </channel>
</rss>

