Skip to content

Commit 4e419dd

Browse files
Merge pull request SharePoint#6975 from SharePoint/thechriskent-patch-1
Update list-form-conditional-show-hide.md
2 parents 663cc76 + 6714199 commit 4e419dd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/declarative-customization/list-form-conditional-show-hide.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Show or hide columns in a list form
33
description: Customize which columns to show or hide using a conditional formula in the list form by constructing a simple formula that are equations performing conditional checks on values in a SharePoint list or library.
4-
ms.date: 04/23/2021
4+
ms.date: 05/07/2021
55
localization_priority: Priority
66
---
77

@@ -134,9 +134,18 @@ The following formula checks if the Yes/No column `[$Promoted]` is equal to a Ye
134134

135135
##### Lookup column
136136

137-
The following formula checks if the lookup column `[$City]` is equal to *Toronto*. To do so, it checks for the value `1;#Toronto` where 1 is an item ID in the lookup list of cities.
137+
> [!NOTE]
138+
> When accessing lookup columns in column or view formatting, you have access to the lookup value and lookup id as separate values. In form formatting and conditional field expressions, both values are returned as a single line of text. For instance, a lookup column referencing an item with item ID 1 (in the source list) with a value of `Toronto` will have a value of `1;#Toronto` when used in form formatting or conditional field expressions.
139+
140+
141+
The following formula checks if the lookup column `[$City]` has a value equal to *Toronto*. To do so, it splits the lookup value result by the separator and checks against the value.
138142

139143
```
140-
=if([$City] == '1;#Toronto', 'true', 'false')
144+
=if(substring([$City],indexOf([$City],';#')+2,1000) == 'Toronto', 'true', 'false')
141145
```
142146

147+
Similarly, you can compare against the ID portion of the lookup using this expression:
148+
149+
```
150+
=if(Number(substring([$City],0,indexOf([$City],';#'))) == 1, 'true', 'false')
151+
```

0 commit comments

Comments
 (0)