Error Message
In ArcGIS Online, when using an Arcade expression to set custom symbology in Map Viewer with the 'Classify data' option enabled, the following error message is returned:
Error:
Normalization is not allowed when ‘valueExpression’ is specified
Cause
Arcade expressions used for visualization are evaluated at draw time, and the results are not stored or indexed in the data. When using an Arcade-driven attribute for classification, smart mapping in Map Viewer computes a numeric range from the expression's results. If the expression produces no variation (for example, all features have the same value), smart mapping cannot generate meaningful class breaks, resulting in an error.
Solution or Workaround
Specify a custom Arcade expression in a new field and set it as the style attribute
- Sign in to ArcGIS Online and navigate to Content > My Content.
- On the My Content tab, select the feature layer to open its item page.
- On the item page, click the Data tab.
- In the Table view, add a new numeric field
- Click + Add field > Numbers > Double. Select Next.
- For Field name and Display name, specify the names. In this example, both are specified as new_rate.
- Click Add field.
- Click the new field Menu icon
and select Calculate. - In the Calculate field view, in the Select Language pane, select Arcade and click Next.
- In the Arcade Expression pane, specify a custom expression using one or more fields in the data, and click Run Calculation. In this example, the function is specified as follows:
$feature.Rate_x + $feature.Rate_y
- Click the Table icon. Ensure the new field has been updated accordingly.
- Click Overview > Open in Map Viewer.
- In Map Viewer, click Styles
. - In the Styles pane, click + Field. Select the new field created in Step 4, and click Add. In this example, new_rate is selected.
- For Pick a style, select the style category and click Style options. In this example, Counts and Amounts (color) is selected.
- In the Style options pane, toggle Classify data on.
- Click Done.
No error is returned when a field is selected as a style option with the 'Classify data' option enabled.
Assign different values in the table
- Sign in to ArcGIS Online and navigate to Content > My Content.
- On the My Content tab, select the feature layer to open its item page.
- On the Overview page, click Open in Map Viewer.
- In the Layers pane, click Options
> Show table. - Change the values in the preferred field to ensure the feature values are not all identical. In this example, one of the values in the Rate_x field is changed from 1 to 0.
- Click Close
to close the table. - Click Styles
. - In the Styles pane, click + Expression. In the expression window, specify the custom expression. In this example, the function is specified as follows:
$feature.Rate_x + $feature.Rate_y
- Click Done.
- For Pick a style, select the style category and click Style options. In this example, the Counts and Amounts (color) is selected.
- In the Style options pane, toggle Classify data on.
- Click Done.
No error is returned when one of the dataset values is changed to include variation and the 'Classify data' option is enabled.