elsenorjose
Technical User
Hello everyone,
I need some help formulating an 'if-then-else' clause.
I have a view with several different projects and tasks. Each project and task has an associated start and end date. Depending on the task, I need to choose one of the following:
Project End Date
Task End Date
Task Start + Task End
So far, this part of my formula works:
However, when I try to add another 'If' to test for another set of tasks and only one date, I get an error.
I also need to add a 3rd 'else if' to test for one more set of task names but I get an error: 'A string is required here' and the 'if' after the 'else' is highlighted. What do I need to do to make this formula work correctly?
Thank you.
Using CR XI on Windows XP Pro and SQL Server 2005.
I need some help formulating an 'if-then-else' clause.
I have a view with several different projects and tasks. Each project and task has an associated start and end date. Depending on the task, I need to choose one of the following:
Project End Date
Task End Date
Task Start + Task End
So far, this part of my formula works:
Code:
If ({usrPDM_QC.taskname} like '*mfg*'
or {usrPDM_QC.taskname} like 'drug product manufacturing'
or {usrPDM_QC.taskname} like '*qc*'
or {usrPDM_QC.taskname} like 'package*'
or {usrPDM_QC.taskname} like 'label*')
then ToText(getLocalTime ({usrPDM_QC.TaskStartDate}),"dd-MMM-yy")+' '+'-'+' '+ToText(getLocalTime ({usrPDM_QC.TaskEndDate}),"dd-MMM-yy")
However, when I try to add another 'If' to test for another set of tasks and only one date, I get an error.
Code:
If ({usrPDM_QC.taskname} like '*mfg*'
or {usrPDM_QC.taskname} like 'drug product manufacturing'
or {usrPDM_QC.taskname} like '*qc*'
or {usrPDM_QC.taskname} like 'package*'
or {usrPDM_QC.taskname} like 'label*')
then ToText(getLocalTime ({usrPDM_QC.TaskStartDate}),"dd-MMM-yy")+' '+'-'+' '+ToText(getLocalTime ({usrPDM_QC.TaskEndDate}),"dd-MMM-yy")
else if {usrPDM_QC.taskname} like 'bulk*' then {usrPDM_QC.ProjEndDate}
I also need to add a 3rd 'else if' to test for one more set of task names but I get an error: 'A string is required here' and the 'if' after the 'else' is highlighted. What do I need to do to make this formula work correctly?
Thank you.
Using CR XI on Windows XP Pro and SQL Server 2005.