Hello,
I'm looking for a sentence that includes the following Case Statement and _days_between combination. We have dates that are populated but based on the Service Code of I or H, different data element may need to be used. Also, the User may enter in the prompt a Service_Param.
Case (?Service_Param? )
when 'I' then ([BeginDate]=_days_between ([I_Service Date],CURRENT_DATE))
else ([BeginDate]=_days_between ([H_Service Date],CURRENT_DATE)
end
Will the above code work?
Thanks a lot!
Quote from: HelloCognos on 07 Mar 2018 10:48:41 AM
Hello,
I'm looking for a sentence that includes the following Case Statement and _days_between combination. We have dates that are populated but based on the Service Code of I or H, different data element may need to be used. Also, the User may enter in the prompt a Service_Param.
Case (?Service_Param? )
when 'I' then ([BeginDate]=_days_between ([I_Service Date],CURRENT_DATE))
else ([BeginDate]=_days_between ([H_Service Date],CURRENT_DATE)
end
Will the above code work?
Thanks a lot!
Hi,
Is this an expression for a filter or for a calculation? If it's a filter, then you need an expression that returns a true or false value for each row
eg
(?Service_Param? = 'I' and <some expression>) OR (?Service_Param? <> 'I' and <some other expression>)
I'm struggling to understand what you are using _days_between() for here. It looks like [BeginDate] should be a date item, but _days_between() returns a number - eg 10 if the interval between the dates is ten days. Can you explain?
MF.
Yes, this is for a calculation and not a filter expression. Sorry about that. So, how can I establish the Case Statement that would show for example 10 for the duration between the current date and the l_service_date OR duration between the current date and the H_service_date?
Thanks a lot
Quote from: HelloCognos on 08 Mar 2018 08:12:44 AM
Yes, this is for a calculation and not a filter expression. Sorry about that. So, how can I establish the Case Statement that would show for example 10 for the duration between the current date and the l_service_date OR duration between the current date and the H_service_date?
Thanks a lot
Hi,
In that case, the expression for your calculation could be
Case (?Service_Param? )
when 'I' then (_days_between(current_date, [I_Service Date]))
else (_days_between(current_date, [H_Service Date]))
end
Cheers!
MF.
Thank you!! :) :)