Forum Discussion

EKIT415's avatar
EKIT415
Copper Contributor
Nov 11, 2021

Conditional formating for lookup column

Hi, 

I am trying to add conditionally format a column to only appear in the form unless "other" is selected from a lookup column 

I have tried using - i thikn 99 is the ID for other but i could only find this out by creating a test list and looking up Other and ading ID column attached to this. 

=if([$Project.LookupID] != 99, 'true', 'false')

=if([$Project] != 99, 'true', 'false')

=if([$Project] == Other, 'true', 'false')

 

i have also tried 

=if(Number(substring([$Project],0,indexOf([$Project],';#'))) == 99, 'true', 'false')

=if(substring([$Project],indexOf([$Project],';#')+2,1000) == 'Other', 'true', 'false')

which are from the windows 'learn to use conditional formulas in a list form" site

None of these formulas work. 

 

  • EKIT415 

     

    Try something like this:

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "debugMode": true,
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "display": "=if([$ColumnD]=='Yes','none','')"
      }
    }

     

    • RL_Alexander's avatar
      RL_Alexander
      Copper Contributor

      Question:
      I have a list that allows users to enroll in classes from based on a separate course list.  The Lookup Field is [StartDate].   How do I only show the Course Dates greater than Today()?
      I tried the following with no success:
      =if([StartDate.lookupValue]<Today(), 'hidden', 'visible')

Resources