2 min to read
Show or Hide column based on condition in SharePoint Online list.
Show or Hide column based on condition in SharePoint Online list
Microsoft announced an updated feature that is shown or hide the column in the SharePoint list based on a value in another column by specifying the conditional formulas, this formula is made with equations. In this blog, we can see how to create this conditional equation and the outcomes of this equation.
How to create a conditional formula?
- Go to SharePoint list → select the column which you want to set a conditional formula
- Select More options → select Edit → Edit form → Edit columns.
- specify the conditional formula based on other columns and click save.
Now let’s consider the equation to perform the actions. The equation must start with = and followed with if condition, if the condition satisfies then it returns true this means it shows the column, else it returns false which makes the column to hide.
In our example, we are applying the formula in the column ‘workpercentage’. if the status value is completed then workpercentage need to be true, which means workpercentage needs to show up.
Or else the workpercentage column will get hidden while editing.
This equation checks the choice column ‘status’ is equal to completed
This following formula check the number column ‘workpercentage’ is less than or equal to 50
We can also do the arithmetic calculation such as adding the two column and checking its sum.
We can act with a date column(M/D/Y)
This data column can also play with operators (less than or equal to)
=if([$StartDate] >= Date(‘4/6/2020’),’true’,’false’) And we can also apply the condition for both start and enddate with the equation.
=if([$StartDate] >= Date(‘4/6/2020’) && [$EndDate] <= Date(‘6/10/2020’),’true’,’false’) For more sample formulas refer: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-conditional-show-hide#specify-conditional-formula-to-show-or-hide-columns
Unsupported column types:
Currently, they do not support the following column type