Skip to content

Commit b3e82d9

Browse files
authored
Corrected split operator syntax
1 parent f1eb0df commit b3e82d9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/declarative-customization/formatting-syntax-reference.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ All fields in ViewFields can be referred in expresisons, even if it is marked `E
442442

443443
All Excel-style expressions begin with an equal (`=`) sign. This style of expression is only available in SharePoint Online and SharePoint Server Subscription Edition starting with the Version 22H2 feature update. This style of expression is not available in SharePoint Server Subscription Edition before the Version 22H2 feature update nor SharePoint Server 2019.
444444

445-
This simple conditional expression evaluates to `none` if `@me` is not equal to `[$Author.email]`, and evaluates to \`\` otherwise:
445+
This simple conditional expression evaluates to `none` if `@me` is not equal to `[$Author.email]`, and evaluates to `''` otherwise:
446446

447447
```JSON
448448
=if(@me != [$Author.email], 'none', '')
@@ -622,7 +622,9 @@ Operators specify the type of operation to perform. The following operators are
622622
- `"txtContent":"=getYear(Date('12/26/1981'))"` results in _1981_
623623
- **toUpperCase**: returns the value converted to upper case (only works on strings) - _Only available in SharePoint Online_
624624
- `"txtContent":"=toUpperCase('DogFood')"` results in _"DOGFOOD"_
625+
625626
**Binary operators** - The following are operators that expect two operands:
627+
626628
- **indexOf**: takes 2 operands. The first is the text (or array) you would like to search within, the second is the text you would like to search for. Returns the index value of the first occurrence of the search term within the string (or array). Indexes start at 0. If the search term is not found within the text (or array), -1 is returned. This operator is case-sensitive. - _Only available in SharePoint Online_
627629
- `"txtContent": "=indexOf('DogFood', 'Dog')"` results in _0_
628630
- `"txtContent": "=indexOf('DogFood', 'F')"` results in _3_
@@ -658,7 +660,7 @@ Operators specify the type of operation to perform. The following operators are
658660
- `"txtContent": "=removeFrom(@currentField, 'Choice 4')"` returns an array with 'Choice 4' removed from the @currentField array
659661
- `"txtContent": "=removeFrom(@currentField, '[email protected]')"` returns an array with '[email protected]' removed from the @currentField array
660662
- **split**: divides the given string into an ordered list of substrings by searching for the given pattern, and returns an array of these substrings
661-
- `"txtContent": "=removeFrom('Hello World', ' ')"` returns an array with 2 strings - 'Hello' and 'World'
663+
- `"txtContent": "=split('Hello World', ' ')"` returns an array with 2 strings - 'Hello' and 'World'
662664
- **addDays**: returns a datetime object with days added (or deducted) from the given datetime value
663665
- `"txtContent": "=addDays(Date('11/14/2021'), 3)"` returns a 11/17/2021, 12:00:00 AM
664666
- `"txtContent": "=addDays(Date('11/14/2021'), -1)"` returns a 11/13/2021, 12:00:00 AM
@@ -680,7 +682,7 @@ Operators specify the type of operation to perform. The following operators are
680682
- `"txtContent":"=replace('Hello world', 'world', 'everyone')"` results in _Hello everyone_
681683
- `"txtContent":"=replace([$MultiChoiceField], 'Choice 1', 'Choice 2')"` returns an array replacing Choice 1 with Choice 2
682684
- `"txtContent":"=replace([$MultiUserField], @me, '[email protected]')"` returns an array replacing @me with '[email protected]'
683-
- **replaceAll**: searches a string for a specified value and returns a new string (or array) where the specified value is replaced.
685+
- **replaceAll**: searches a string for a specified value and returns a new string (or array) where the specified value is replaced. Incase of string, all instances of the value will be replaced.
684686
- `"txtContent":"=replaceAll('H-e-l-l-o W-o-r-l-d', '-', '')"` results in _Hello World_
685687
- **padStart**: pads the current string with another string until the resulting string reaches the given length. The padding is applied from the start of the current string.
686688
- `"txtContent":"=padStart('DogFood', 10, 'A')"` results in _AAADogFood_
@@ -718,9 +720,9 @@ See [here](./column-formatting.md#formatting-multi-value-fields) for examples.
718720
- \+
719721
- indexOf ( *for string length workaround* )
720722

721-
`+` can be used when there is a need to concatenate strings, for instance : `"txtContent": "=[$column1] + ' ' + [$column2] + 'some other text"`
723+
`+` can be used when there is a need to concatenate strings, for instance : `"txtContent": "=[$column1] + ' ' + [$column2] + 'some other text'"`
722724

723-
`indexOf` Since the operator `length` doesn't work for string value types ( it will return 1 or 0 ), `indexOf` can serve us as a nice workaround to get the length of a string, for instance: `indexOf([$column1] + '^', '^')`. We will use `'^'` or any other character we may want to use to find out the end of the string.
725+
`indexOf` since the operator `length` doesn't work for string value types ( it will return 1 or 0 ), `indexOf` can serve us as a nice workaround to get the length of a string, for instance: `indexOf([$column1] + '^', '^')`. We will use `'^'` or any other character we may want to use to find out the end of the string.
724726

725727
## Operands
726728

0 commit comments

Comments
 (0)