2 Replies Latest reply on Nov 15, 2016 12:11 AM by arvind singh

    Syntax Error- If

    Natalie Vu

      I'm getting a syntax error when I create the calculated field. Please assist.


      If {[Report Submitted Date] - [START_EXPENSE_DATE]} > "45" AND [Org Id] <> "83" OR "115"

      THEN 'Show'

      ELSE 'Hide'



      IF  {[Report Submitted Date] - [START_EXPENSE_DATE]} > "60" AND [Org Id] = "83" OR "115"

      THEN 'Show'

      ELSE 'Hide' END


        • 1. Re: Syntax Error- If

          First of all I think you'll need to use DATEDIFF() to subtract the days instead of subtracting the dates like you are doing (this is assuming they are actual dates and not days at the DB level).


          Datediff : DATEDIFF('day', [Report submitted date], [start expense date])


          then, create another calculation to show/hide based on conditions.


          IF [Datediff] > 45 and [Org ID] <> '83' or [Org ID] <> '115' THEN 'show' else 'hide' end


          I am not sure what you are trying to add in the 2 IF statements. The result of both IF statements is a string, so you are not going to be able to add them the way you have described. Also curly brackets are not needed before the IF.

          While writing an OR statement you need to mention the field name again.


          Hope this helps!

          • 2. Re: Syntax Error- If
            arvind singh

            You have 2 ends keyword in the last line .

            So remove one of them.