IF statements and conditional formatting-Code error

Version 2



    I have a bit of an issue with IF statements. I have a number of engineer's with multiple jobs allocated to them per day. In this specific case, I would like to have some kind of conditional formatting on the Task Identification Number.

    I would like the task identification number for all 'f' (Failed tasks) to show up in red.


    The calculated field used to display whether a job is failed or passed is this:


    if[Repdate]>=[Commitment] then 'f' elseif [Repdate]<[Commitment] then 'p' END


    I'm trying to show something like this:


    if (DATEPART('hour',[Estimated Start Time]) >= 14 ) then [Task Identification Number] "BLACK" else [Task Identification Number] "RED" END


    The estimated start time is in the Date Time format. This could also work in this way


    if [flag1] ='TRUE' then [Task Identification Number] 'BLAC'  ELSEIF [flag1] = 'FALSE' then [Task Identification Number] 'RED' END


    However, I seem to have an issue in my code.

    Would appreciate any help!