Skip to content

Column formatting forEach property does not support spaces #8891

@jensotto

Description

@jensotto

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

Declarative list formatting

Developer environment

Windows

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • Edge 112.0.1722.39

Describe the bug / error

Its not possible to use operators in the forEach property of column formatting.
The following definition fails with the error message:Failure: split(replaceAll(@currentField,'; is not an array, array expected in the expression value in split(replaceAll(@currentField,'; ',';'),';')

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "debugMode": true,
  "elmType": "div",
  "children": [
    {
      "elmType": "div",
      "forEach": "value in split(replaceAll(@currentField,'; ',';'),';')",
      "txtContent": "='*'+[$value]"
    }
  ]
}

Content in the field is a semicolon separated list: 1; 2; 3; 4

Spaces can be used in other properties like for example txtContent.

Steps to reproduce

  1. Add a new list to SharePoint
  2. Add the content "1; 2; 3; 4" to the title field (note the spaces after each semicolon)
  3. Add the column formatting from the bug description above.
  4. Rendering fails.
  5. Remove the space in the second replaceAll argument.
  6. Rendering works, but there is a space in front of every item except the first one.

Expected behavior

It should be possible to use spaces in operators in the forEach porperty

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:list-formattingCategory: View, row & column formatting with JSONtype:archive-old-issueIssues which are closed as tool old for active worktype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions